File tree Expand file tree Collapse file tree 4 files changed +16
-23
lines changed
Expand file tree Collapse file tree 4 files changed +16
-23
lines changed Original file line number Diff line number Diff line change 11from flask import Flask
2- from waitress import serve
2+ import os
33
44app = Flask (__name__ )
55
@@ -8,4 +8,6 @@ def hello():
88 return "Hello World!"
99
1010if __name__ == '__main__' :
11- serve (app , host = '0.0.0.0' , port = 8080 )
11+ port = int (os .environ .get ('FLASK_PORT' )) or 8080
12+
13+ app .run (port = port ,host = '0.0.0.0' )
Original file line number Diff line number Diff line change 1- # ###
2- # This Dockerfile is used in order to build a container that runs the Spring Boot application
3- #
4- # Build the image with:
5- #
6- # docker build -f docker/Dockerfile -t python/sample-basic .
7- #
8- # Then run the container using:
9- #
10- # docker run -i --rm -p 8081:8081 python/sample-basic
11- # ###
121FROM python:slim
132
14- WORKDIR /projects
3+ # By default, listen on port 8081
4+ EXPOSE 8081/tcp
5+ ENV FLASK_PORT=8081
156
16- RUN python3 -m venv venv
17- RUN . venv/bin/activate
7+ # Set the working directory in the container
8+ WORKDIR /projects
189
19- # optimize image caching
10+ # Copy the dependencies file to the working directory
2011COPY requirements.txt .
12+
13+ # Install any dependencies
2114RUN pip install -r requirements.txt
2215
16+ # Copy the content of the local src directory to the working directory
2317COPY . .
2418
25- EXPOSE 8081
26- CMD [ "waitress-serve" , "--port=8081" , "app:app" ]
27-
19+ # Specify the command to run on container start
20+ CMD [ "python" , "./app.py" ]
Original file line number Diff line number Diff line change 1- Flask == 2.0.0
2- itsdangerous == 2.0.1
3- waitress == 2.0.0
1+ Flask == 2.1.0
You can’t perform that action at this time.
0 commit comments