Skip to content

Commit 0ae9afa

Browse files
authored
Merge pull request #6 from schultzp2020/main
Updated dependencies
2 parents dcd255b + f70c293 commit 0ae9afa

File tree

4 files changed

+16
-23
lines changed

4 files changed

+16
-23
lines changed

.devfile/icon/python.png

-5.04 KB
Binary file not shown.

app.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from flask import Flask
2-
from waitress import serve
2+
import os
33

44
app = Flask(__name__)
55

@@ -8,4 +8,6 @@ def hello():
88
return "Hello World!"
99

1010
if __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')

docker/Dockerfile

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
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-
####
121
FROM 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
2011
COPY requirements.txt .
12+
13+
# Install any dependencies
2114
RUN pip install -r requirements.txt
2215

16+
# Copy the content of the local src directory to the working directory
2317
COPY . .
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" ]

requirements.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
Flask==2.0.0
2-
itsdangerous==2.0.1
3-
waitress==2.0.0
1+
Flask==2.1.0

0 commit comments

Comments
 (0)