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