diff --git a/.devfile/icon/python.png b/.devfile/icon/python.png deleted file mode 100644 index fe26d4a23d..0000000000 Binary files a/.devfile/icon/python.png and /dev/null differ diff --git a/app.py b/app.py index cad286e543..ebb495458d 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,5 @@ from flask import Flask -from waitress import serve +import os app = Flask(__name__) @@ -8,4 +8,6 @@ def hello(): return "Hello World!" if __name__ == '__main__': - serve(app, host='0.0.0.0', port=8080) + port = int(os.environ.get('FLASK_PORT')) or 8080 + + app.run(port=port,host='0.0.0.0') \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile index 16fdeb3bdc..4e1e68b803 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,27 +1,20 @@ -#### -# This Dockerfile is used in order to build a container that runs the Spring Boot application -# -# Build the image with: -# -# docker build -f docker/Dockerfile -t python/sample-basic . -# -# Then run the container using: -# -# docker run -i --rm -p 8081:8081 python/sample-basic -#### FROM python:slim -WORKDIR /projects +# By default, listen on port 8081 +EXPOSE 8081/tcp +ENV FLASK_PORT=8081 -RUN python3 -m venv venv -RUN . venv/bin/activate +# Set the working directory in the container +WORKDIR /projects -# optimize image caching +# Copy the dependencies file to the working directory COPY requirements.txt . + +# Install any dependencies RUN pip install -r requirements.txt +# Copy the content of the local src directory to the working directory COPY . . -EXPOSE 8081 -CMD [ "waitress-serve", "--port=8081", "app:app"] - +# Specify the command to run on container start +CMD [ "python", "./app.py" ] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 11f782fe58..c97a5aa7b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1 @@ -Flask==2.0.0 -itsdangerous==2.0.1 -waitress==2.0.0 \ No newline at end of file +Flask==2.1.0 \ No newline at end of file