Skip to content

Python flask, docker, githubactions learning playground.

License

Notifications You must be signed in to change notification settings

Virajdatt/Python_Docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pipeline status

Simple docker image for running a Flask App:-

The flask server serves a static html, which asks for an input sentece. The input sentence is then posted to the flask server and it creates a TextBlob object, of the input sentence and returns the sentiment polarity based on the words in the input sentence.

The implementation can be seen in the New.py script.

We can create a docker image out of it using the command : $docker build -t <name_of_image> . # . stands for the current directory

We can run the so created image using the command: $docker run -d -P <name_of_image>

We can then check the mapping of port from host to container by running the command(under PORTS): $docker ps

In browser run localhost:5000 to get the following:-

Front-End

Front-End Image

Infernce

Infernce Image

This repo now has github actions setup, the github actions do the following.

  1. Copy the repo over to a remote Ubuntu Server, which has docker pre-installed
  2. Build our docker image on the remote server
  3. Spin up a docker container using the image built in above step
  4. Test the container app with a curl get request on port 5000
  5. NOTE:- This wont be hosting the app
  6. NOTE:- The line 19 under /.github/workflows/main.yml enables one to skip the github actions if commit message has the string "ci skip"

TO-DO

  1. Imporve the frontend using CSS, javascript and anyother javascript frameworks.
  2. Use a better backend for sentiment inference.
  3. Include actions to deploy to a hosting platform.

**P.S:- The repo was built a couple of years ago when I was trying to learn flask, docker and used this repo for taking notes.**

About

Python flask, docker, githubactions learning playground.

Topics

Resources

License

Stars

Watchers

Forks