roosterwijs/backend/Dockerfile
2026-06-09 22:46:23 +02:00

27 lines
805 B
Docker

# Backend: Django achter gunicorn.
FROM python:3.12-slim
# Geen .pyc-bestanden, ongebufferde logs (handig in Docker).
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
# Systeempakketten die psycopg/gunicorn soms nodig hebben.
RUN apt-get update \
&& apt-get install -y --no-install-recommends libpq5 \
&& rm -rf /var/lib/apt/lists/*
# Eerst requirements (betere build-cache), dan de rest.
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# entrypoint wacht op de database, migreert en verzamelt statics.
RUN chmod +x /app/entrypoint.sh
EXPOSE 8000
ENTRYPOINT ["/app/entrypoint.sh"]
# 3 workers is ruim voldoende voor de kleine aantallen in het SO.
CMD ["gunicorn", "config.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "3"]