neues dockerfile mit gunicorn Server

This commit is contained in:
Erik Thiele
2026-06-20 16:49:48 +02:00
parent e18414ab79
commit 3eb5cf9d8d
4 changed files with 20 additions and 5 deletions

8
.dockerignore Normal file
View File

@@ -0,0 +1,8 @@
.git
.gitignore
media/
__pycache__/
*.pyc
.DS_Store
README.md
AGENTS.md

View File

@@ -1,12 +1,16 @@
FROM python:3.12-slim FROM python:3.13-slim
WORKDIR /app WORKDIR /app
COPY requirements.txt ./ COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt gunicorn
COPY . . COPY . .
RUN addgroup --system app && adduser --system --ingroup app app && \
chown -R app:app /app
USER app
EXPOSE 5005 EXPOSE 5005
CMD ["python", "app.py"] CMD ["gunicorn", "-b", "0.0.0.0:5005", "-w", "4", "app:app"]

View File

@@ -124,6 +124,8 @@ Server läuft auf `http://localhost:5005`.
docker compose up -d docker compose up -d
``` ```
Server läuft auf `http://localhost:5005` (gunicorn mit 4 Workern, non-root User).
--- ---
## Routen ## Routen

3
app.py
View File

@@ -1584,6 +1584,7 @@ def admin_users_reset_password(email):
# ------------------------------------------------- # -------------------------------------------------
# Main # Main
# ------------------------------------------------- # -------------------------------------------------
init_user_db()
if __name__ == "__main__": if __name__ == "__main__":
init_user_db()
app.run(debug=True, host="0.0.0.0", port=5005) app.run(debug=True, host="0.0.0.0", port=5005)