Files
2026-01-29 17:10:20 +01:00

21 lines
607 B
Docker

FROM python:3.12-slim
# Prevent Python from writing .pyc files and enable unbuffered logs.
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install dependencies first for better layer caching.
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 5000
# 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"]