# Multi-stage build for the Undercooked game server. # Stage 1 resolves and installs dependencies; stage 2 is a slim runtime. # No database stage: live game state is in-memory by design (see .agents/PLAN.md). FROM docker.io/python:3.12-slim AS builder ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \ PIP_NO_CACHE_DIR=1 WORKDIR /build COPY pyproject.toml README.md ./ COPY src ./src RUN pip install --prefix=/install . FROM docker.io/python:3.12-slim AS runtime ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ DEBUGPY=0 \ UNDERCOOKED_HOST=0.0.0.0 \ UNDERCOOKED_PORT=8000 \ UNDERCOOKED_LEVELS_DIR=/app/levels \ UNDERCOOKED_STATIC_DIR=/app/app/static WORKDIR /app RUN useradd --create-home --uid 10001 player COPY --from=builder /install /usr/local COPY src ./src COPY levels ./levels COPY app ./app COPY README.md ./ USER player EXPOSE 8000 HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD python -c "import urllib.request,sys;sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/healthz',timeout=2).status==200 else 1)" ENTRYPOINT ["python", "-m", "undercooked"]