war_gaming / Dockerfile
misack's picture
Claude Opus 4.7 (1M context)
Add HF Spaces deployment scaffold + trial password gate
17a40e4
Raw History Blame Contribute Delete
914 Bytes
# Wargame backend image — sized for Hugging Face Spaces (Docker SDK).
#
# HF Spaces conventions baked in:
# - container listens on port 7860
# - persistent storage mounts at /data, so WARGAME_GAMES_DIR points there
#
# Local sanity check:
# docker build -t wargame .
# docker run --rm -p 7860:7860 --env-file .env -v $(pwd)/games:/data wargame
FROM python:3.12-slim
# uv: fast resolver/installer; reads pyproject.toml + uv.lock directly
RUN pip install --no-cache-dir uv
WORKDIR /app
# Copy lockfile + project metadata first so dependency installs are cached
# across code-only edits.
COPY pyproject.toml uv.lock ./
COPY wargame/ ./wargame/
# Install main deps only (no [dev] extras). --frozen forces uv.lock to match.
RUN uv sync --frozen
ENV WARGAME_GAMES_DIR=/data \
PYTHONUNBUFFERED=1
EXPOSE 7860
CMD ["uv", "run", "uvicorn", "wargame.api.app:app", "--host", "0.0.0.0", "--port", "7860"]