# FastAPI inference Space for Committed. # This is the DEPLOY Dockerfile, living in the HF Space repo (not the in-repo # src/committed/serving/Dockerfile, which is the reference container definition). # It installs the `committed` package straight from GitHub (single source of # truth, per ADR 0047) and runs the FastAPI app. No model is baked: the engine # pulls the fine-tuned GGUF from the Hub at runtime via its defaults (ADR 0048) # or the COMMITTED_MODEL_* Space Variables. FROM python:3.11-slim # llama-cpp-python compiles native code at install time, so a C/C++ toolchain # is required in the build image. RUN apt-get update \ && apt-get install -y --no-install-recommends build-essential git \ && rm -rf /var/lib/apt/lists/* # HF Spaces run as a non-root user (uid 1000). Create it and own the workdir so # the model cache under HF_HOME is writable at runtime. RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ HF_HOME=/home/user/.cache/huggingface WORKDIR /home/user/app # Install the package and its required (serve-minimal) deps from GitHub. # Prebuilt CPU wheels for llama-cpp-python avoid a slow source compile on the # free CPU Space; the extra index is where those wheels are published. RUN pip install --no-cache-dir \ --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu \ "committed @ git+https://github.com/marzoukbaig14/Committed.git" # HF Spaces route public traffic to port 7860. EXPOSE 7860 # Launch the FastAPI app. The model loads once at startup (lifespan); first boot # downloads the GGUF from the Hub into HF_HOME, then it is cached. CMD ["uvicorn", "committed.serving.api:app", "--host", "0.0.0.0", "--port", "7860"]