From 9d26e4a2ca10bbcce188db7bd6c67017a2da0fab Mon Sep 17 00:00:00 2001 From: Hamid Ebadi Date: Thu, 24 Jul 2025 18:25:26 +0200 Subject: [PATCH] chore: update dockerfile and requirements.txt --- Dockerfile | 9 ++++----- README.md | 15 +++++++++++++++ requirements.txt | 3 ++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index f3f02db..074dbd5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM python:3.8.5-alpine3.12 -LABEL maintainer "@fabdelgado " +LABEL maintainer="@fabdelgado " RUN apk add --no-cache gcc musl-dev linux-headers @@ -10,11 +10,10 @@ COPY . /usr/src/app RUN pip3 install --no-cache-dir -r requirements.txt -ENV PORT 80 -ENV FLASK_APP main.py +ENV FLASK_APP=main.py -ENV FLASK_RUN_HOST 0.0.0.0 +ENV FLASK_RUN_HOST=0.0.0.0 #prod -CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 microblog:app +CMD ["gunicorn", "--bind", ":80", "--workers", "1", "--threads", "8", "--timeout", "0", "microblog:app"] diff --git a/README.md b/README.md index c75275d..dc6fe4d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,21 @@ Multilingual Flask Boilerplate with smart routing optimised for search engines and including separate URL’s for each language. I created this application as example code for a Medium article which is linked below. +### Build + +``` +docker build -t flask-gunicorn-app . +docker run -p 80:80 --name multilangapp flask-gunicorn-app +``` +Results in: +``` +[2025-07-24 16:20:00 +0000] [1] [INFO] Starting gunicorn 23.0.0 +[2025-07-24 16:20:00 +0000] [1] [INFO] Listening at: http://0.0.0.0:80 (1) +[2025-07-24 16:20:00 +0000] [1] [INFO] Using worker: gthread +[2025-07-24 16:20:00 +0000] [8] [INFO] Booting worker with pid: 8 +``` +The website is available at [http://0.0.0.0:80](http://0.0.0.0:80) + ### Live Demo A live demo of the application can be found here:
http://schmidni.pythonanywhere.com/lang10 diff --git a/requirements.txt b/requirements.txt index 4bf8c06..b844c38 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ Jinja2==2.11.3 MarkupSafe==1.1.1 mccabe==0.6.1 oauthlib==3.1.0 -pkg-resources==0.0.0 +# pkg-resources==0.0.0 pycodestyle==2.7.0 pyflakes==2.3.0 PyMySQL==1.0.2 @@ -28,3 +28,4 @@ toml==0.10.2 tweepy==3.10.0 urllib3==1.25.11 Werkzeug==1.0.1 +gunicorn==23.0.0