Build the Docker image using the following command
$ docker build -t python-flask:<tag> .
Run the Docker container using the command below.
$ docker run -d -p 8080:8080 python-flask:<tag>
Follow the steps mentioned below for git based pipeline
-
Ensure that you have a git project
-
Edit
app/src/server.py
-
Commit your changes
$ git add . $ git commit -m "message"
-
Push the changes to git
$ git push <remote> master
$ cd app/src
$ pip install -r requirements.txt
$ FLASK_APP=__init__.py flask run
Default Port for application is 8080
.
Application port can be changed by modifying the variable bind
in app/conf/gunicorn_config.py
or setting Environment Variable
bind = "0.0.0.0:" + os.environ.get("APP_PORT", "<NEW_PORT>")
$ docker run -d -p 8080:<NEW_PORT> python-flask:<tag>
-
APP_PORT
- Application port can also be specified by setting APP_PORT ENV$ docker run -d -p 8080:<NEW_PORT> -e APP_PORT='<NEW_PORT>' python-flask:<tag>