From cce4565f1265623066c99dce61f7bf3b08d59fa9 Mon Sep 17 00:00:00 2001 From: elpatron Date: Wed, 23 Jul 2025 11:01:18 +0200 Subject: [PATCH] =?UTF-8?q?README=20und=20Dockerfile:=20Hinweis=20auf=20Gu?= =?UTF-8?q?nicorn/WSGI=20und=20Produktion=20erg=C3=A4nzt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 11 ++++------- README.md | 7 +++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index c204f34..07083d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,17 +6,14 @@ WORKDIR /app # Abhängigkeiten kopieren und installieren COPY requirements.txt ./ -RUN pip install --no-cache-dir -r requirements.txt +RUN pip install --no-cache-dir -r requirements.txt \ + && pip install --no-cache-dir gunicorn # App-Code kopieren COPY . . -# Flask-Umgebungsvariablen setzen -ENV FLASK_APP=app.py -ENV FLASK_RUN_HOST=0.0.0.0 - # Exponiere Port 5000 EXPOSE 5000 -# Starte die App -CMD ["flask", "run"] \ No newline at end of file +# Starte die App mit Gunicorn +CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:app"] \ No newline at end of file diff --git a/README.md b/README.md index 9d9bbfd..d7441ae 100644 --- a/README.md +++ b/README.md @@ -29,15 +29,18 @@ python app.py Die App ist dann unter http://localhost:5000 erreichbar. -## Docker +## Docker (empfohlen für Produktion) -Alternativ kann die App mit Docker gestartet werden: +Die App läuft im Container mit dem WSGI-Server **Gunicorn**: ``` docker build -t datumsrechner . docker run -p 5000:5000 datumsrechner ``` +- Gunicorn startet automatisch (siehe Dockerfile) +- Empfohlen für produktiven Einsatz + ## Entwicklung & Hinweise - Die HTML-Templates liegen im Ordner `templates/` (Trennung von Logik und Darstellung) - Das Projekt ist auf Gitea gehostet: https://gitea.elpatron.me/elpatron/datecalc