new file: .dockerignore
new file: Dockerfile new file: __pycache__/app.cpython-310.pyc new file: app.py new file: requirements.txt new file: static/css/style.css new file: templates/base.html new file: templates/index.html new file: templates/weather.html
This commit is contained in:
33
Dockerfile
Normal file
33
Dockerfile
Normal file
@@ -0,0 +1,33 @@
|
||||
# DWD Wetter
|
||||
FROM python:3.11-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV FLASK_APP=app.py
|
||||
ENV FLASK_ENV=production
|
||||
|
||||
# Non-root user
|
||||
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
|
||||
USER appuser
|
||||
|
||||
# 4 workers, 120s timeout (DWD requests can be slow)
|
||||
CMD ["gunicorn", \
|
||||
"--bind", "0.0.0.0:5000", \
|
||||
"--workers", "4", \
|
||||
"--timeout", "120", \
|
||||
"--keep-alive", "5", \
|
||||
"--access-logfile", "-", \
|
||||
"--error-logfile", "-", \
|
||||
"app:app"]
|
||||
|
||||
Reference in New Issue
Block a user