From 08d6d7ceb2268cc2c8d16ca80cc736fc36b70325 Mon Sep 17 00:00:00 2001 From: bramval Date: Thu, 29 Jan 2026 17:10:20 +0100 Subject: [PATCH] v1.2 --- Dockerfile | 6 ++++-- README.md | 2 ++ app.py | 7 ++++++- release.py | 2 +- requirements.txt | 3 ++- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 37b0b05..d8a7b6b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,5 +14,7 @@ COPY . . EXPOSE 5000 -# Keep testing and local dev via `flask` if desired; docker runs the app directly. -CMD ["python", "app.py"] +# Use Gunicorn (production WSGI server) in Docker. +# We keep the container compatible with the PORT env var used in docker-compose. +# JSON-form CMD doesn't expand env vars, so we use a shell form here. +CMD ["sh", "-c", "gunicorn --bind 0.0.0.0:${PORT:-5000} --workers 2 --threads 4 app:app"] diff --git a/README.md b/README.md index 330fe48..a17d7cc 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ Then run: docker compose up --build ``` +Docker runs the app using **Gunicorn** (production WSGI server). + Open: http://127.0.0.1:5000 ## Release (git + docker) diff --git a/app.py b/app.py index 2621e6a..f06ac6b 100644 --- a/app.py +++ b/app.py @@ -131,7 +131,12 @@ def create_app() -> Flask: return app +# WSGI entrypoint for production servers like Gunicorn. +# Gunicorn will look for a module-level callable named `app` by default when +# you run `gunicorn app:app`. +app = create_app() + + if __name__ == "__main__": - app = create_app() # For production: use a proper WSGI server (gunicorn/uwsgi). app.run(host="0.0.0.0", port=int(os.environ.get("PORT", "5000")), debug=True) diff --git a/release.py b/release.py index 459729c..9ec3a01 100644 --- a/release.py +++ b/release.py @@ -4,4 +4,4 @@ This module exists so the running application and/or deployments can introspect which version is currently deployed. """ -VERSION = "1.1" \ No newline at end of file +VERSION = "v1.2" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 9d3c20b..8530948 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ Flask==3.0.3 feedparser==6.0.11 -requests==2.32.3 \ No newline at end of file +requests==2.32.3 +gunicorn==22.0.0 \ No newline at end of file