From 4ab0e564ef5e63ec60f9473bfbd1ebdd990a9341 Mon Sep 17 00:00:00 2001 From: Phillip Tarrant Date: Thu, 9 Jul 2026 12:45:49 -0500 Subject: [PATCH] chore(api): bundle canon log schemas into image; repo-root build context Co-Authored-By: Claude Opus 4.8 (1M context) --- .dockerignore | 14 ++++++++++++++ api/Dockerfile | 12 ++++++------ docker-compose.yml | 8 ++++++-- 3 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..81987b7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +.git +.claude +client +content +docs/* +!docs/schemas +**/__pycache__ +**/*.py[cod] +.venv +venv +**/.pytest_cache +api/tests +api/.env +api/.env.* diff --git a/api/Dockerfile b/api/Dockerfile index 2eb6545..f9c575b 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -1,8 +1,7 @@ -# /api — FastAPI proxy (charter §4). Docker-based for parity across -# dev / homelab VPS / fly.io. +# /api — FastAPI proxy (charter §4). Build context is the repo root so the +# canon log schemas (/docs/schemas) are bundled into the image. FROM python:3.12-slim -# Faster, quieter Python in containers. ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_NO_CACHE_DIR=1 @@ -10,11 +9,12 @@ ENV PYTHONUNBUFFERED=1 \ WORKDIR /app # Install deps first so the layer caches when only app code changes. -COPY requirements.txt . +COPY api/requirements.txt . RUN pip install --no-cache-dir -r requirements.txt -# App code. -COPY app ./app +# App code + the schema contract (single source of truth in docs/schemas). +COPY api/app ./app +COPY docs/schemas ./schemas # Run as non-root. RUN useradd --create-home --uid 1000 appuser diff --git a/docker-compose.yml b/docker-compose.yml index 81ec3b8..cfba5e4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,21 @@ # Local dev — run the proxy in Docker with live reload. # docker compose up --build +# Build context is the repo root so docs/schemas is available to the image. # Ollama runs on the homelab (charter §4), not here — point OLLAMA_BASE_URL at it. services: api: - build: ./api + build: + context: . + dockerfile: api/Dockerfile ports: - "8000:8000" env_file: - ./api/.env environment: PORT: 8000 - # Mount source + reload so edits are live without a rebuild. + # Mount source + schemas so edits are live without a rebuild. volumes: - ./api/app:/app/app:ro + - ./docs/schemas:/app/schemas:ro command: > uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload