FROM python:3.11-slim # Build essentials for any source-built deps RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* # HF Spaces requires a non-root user with uid 1000 RUN useradd -m -u 1000 user USER user WORKDIR /app ENV PATH=/home/user/.local/bin:$PATH \ PYTHONPATH=/app/src \ PYTHONUNBUFFERED=1 \ HF_HOME=/home/user/.cache/huggingface # 1. Install dependencies (cached layer) COPY --chown=user requirements.txt /app/requirements.txt RUN pip install --user --no-cache-dir -r /app/requirements.txt # 2. Copy source + frontend + curated examples COPY --chown=user src/ /app/src/ COPY --chown=user web/ /app/web/ COPY --chown=user data/ /app/data/ # Model + tokenizer are pulled from the Hub at runtime. # HF_TOKEN is injected by HF Spaces as an env var if you set it in # Settings → Secrets (required for private repos). # ANTHROPIC_API_KEY (also a secret) unlocks the translation toggle. ENV VINTAGE_CHECKPOINT=camustech/vintage-200m-v0.1 \ VINTAGE_TOKENIZER=camustech/vintage-200m-v0.1 EXPOSE 7860 CMD ["python", "-m", "camus_vintage.chat.server", \ "--host", "0.0.0.0", "--port", "7860", \ "--device", "cpu"]