# ── The Abyss — backend for Hugging Face Spaces (Docker SDK) ────────────────── # Single CPU container: FastAPI + uvicorn serving the from-scratch Abyss-1 model. # The model checkpoint is pulled from the HF Hub at boot (set ABYSS_HF_REPO), # so it is NOT baked into this image — that keeps the Space small. # # This folder is assembled by assemble.py, which copies server/, ml/ (model + # tokenizer) and agent/ next to this Dockerfile before you push to the Space. FROM python:3.11-slim ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_NO_CACHE_DIR=1 # Build tools for any wheels that need to compile; removed afterwards. RUN apt-get update && apt-get install -y --no-install-recommends build-essential \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # CPU-only PyTorch first (small; avoids pulling multi-GB CUDA wheels). RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu # The rest of the Python deps. COPY requirements_server.txt . RUN pip install --no-cache-dir -r requirements_server.txt # Non-root user — Hugging Face Spaces runs the container as uid 1000. RUN useradd -m -u 1000 appuser ENV HOME=/home/appuser \ PATH=/home/appuser/.local/bin:$PATH \ HF_HOME=/home/appuser/.cache/huggingface # Application code (staged alongside this Dockerfile by assemble.py). COPY server/ ./server/ COPY ml/ ./ml/ COPY agent/ ./agent/ COPY run_server.py . # Make /app writable by the runtime user — the SQLite DB (conversation.db) and # the agent's sandboxed workspace are created here at runtime. RUN chown -R appuser:appuser /app USER appuser # HF Spaces expects the app on 7860 (declared via app_port in README.md). ENV PORT=7860 EXPOSE 7860 CMD ["python", "run_server.py"]