# Base image pinned by digest (python:3.13-slim, linux/amd64 for the Droplet). # Replace REPLACE_BASE_DIGEST with the value recorded in the 6.4.1 baseline. FROM python:3.13-slim@sha256:e48f59cdba69a3cbd9ed2cf0f348d90d45a8d350d98134cf1070bc106ee9ed90 linux/amd64 ARG APP_COMMIT=development ENV APP_COMMIT=$APP_COMMIT PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 WORKDIR /app COPY requirements.txt . # Exact, hash-checked dependency versions (direct + transitive) from requirements.txt RUN pip install --no-cache-dir --require-hashes -r requirements.txt COPY app.py . USER 10001:10001 EXPOSE 8000 HEALTHCHECK --interval=10s --timeout=3s --start-period=10s --retries=3 CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=2)" CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "1", "--worker-tmp-dir", "/tmp", "app:app"]