# Amana — single-container deploy for Hugging Face Spaces (sdk: docker). # Stage 1 builds the React SPA; stage 2 runs FastAPI, which serves both /api and the built SPA. # ---- Stage 1: build the React frontend ---- FROM node:20-slim AS frontend WORKDIR /app/frontend COPY frontend/package.json frontend/package-lock.json* ./ RUN npm ci COPY frontend/ ./ RUN npm run build # ---- Stage 2: Python runtime ---- FROM python:3.11-slim WORKDIR /app COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt # App code + data, then build the Chroma index at image-build time (local embeddings, no API key, # no spend) so the Space starts with no ingestion step. This also caches the embedding model layer. COPY src/ ./src/ COPY scripts/ ./scripts/ COPY data/ ./data/ COPY api.py ./ RUN python -m scripts.build_index # The built SPA from stage 1. COPY --from=frontend /app/frontend/dist ./frontend/dist # Make data writable for the non-root user HF Spaces runs as (audit log + Chroma sqlite). RUN chmod -R a+rwX /app/data ENV LLM_PROVIDER=anthropic # Public-demo spend cap: lock /api/triage to Anthropic + no cache-bypass so a public Space can't be # used as a billing faucet (max spend = the 18 fixed campaigns once each per restart). See api.py. ENV PUBLIC_DEMO=1 EXPOSE 7860 # Shell form so $PORT (if the platform injects one) is honoured; defaults to 7860. CMD uvicorn api:app --host 0.0.0.0 --port ${PORT:-7860}