Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed BIN -5.04 KB .devfile/icon/python.png
Binary file not shown.
6 changes: 4 additions & 2 deletions 6 app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from flask import Flask
from waitress import serve
import os

app = Flask(__name__)

Expand All @@ -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')
29 changes: 11 additions & 18 deletions 29 docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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" ]
4 changes: 1 addition & 3 deletions 4 requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
Flask==2.0.0
itsdangerous==2.0.1
waitress==2.0.0
Flask==2.1.0
Morty Proxy This is a proxified and sanitized view of the page, visit original site.