FROM python:3.12-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 WORKDIR /app # Install build dependencies (needed for some Python packages, e.g. Pillow) RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ && rm -rf /var/lib/apt/lists/* # Pre-install requirements at build time so the layer is cached. # The entrypoint re-runs pip install on every container start to pick up # any changes that arrived via git pull without needing a rebuild. COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # The source code is NOT copied here — the git repo is bind-mounted # at /app at runtime (see docker-compose.yml). EXPOSE 8000 # entrypoint.sh lives in the mounted repo at /app/docker/entrypoint.sh ENTRYPOINT ["/app/docker/entrypoint.sh"]