From abfd7fedc85d993cebc05f3abbc2db2ba64e81ef Mon Sep 17 00:00:00 2001 From: Michael Pilosov Date: Mon, 6 Apr 2026 15:54:20 -0600 Subject: [PATCH] Add Dockerfile and health endpoints --- .dockerignore | 4 ++++ Dockerfile | 15 +++++++++++++++ src/chess_pressure/app.py | 11 +++++++++++ 3 files changed, 30 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..659abef --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.venv +.git +__pycache__ +*.pyc diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6a59c0e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim AS builder + +WORKDIR /app +COPY pyproject.toml uv.lock README.md ./ +COPY src/ src/ +RUN uv sync --no-dev --locked --no-editable + +FROM python:3.13-slim-bookworm + +WORKDIR /app +COPY --from=builder /app/.venv /app/.venv +ENV PATH="/app/.venv/bin:$PATH" + +EXPOSE 8888 +CMD ["chess-pressure"] diff --git a/src/chess_pressure/app.py b/src/chess_pressure/app.py index 3f45e50..ee25c72 100644 --- a/src/chess_pressure/app.py +++ b/src/chess_pressure/app.py @@ -31,6 +31,17 @@ class MoveRequest(BaseModel): uci: str +# --- Health --- + + +@app.get("/health", include_in_schema=False) +@app.get("/up", include_in_schema=False) +@app.get("/status", include_in_schema=False) +@app.get("/health-check", include_in_schema=False) +def health(): + return {"status": "ok"} + + # --- API ---