# Hugging Face Docker Space. # Space settings -> Variables and secrets: # GITHUB_TOKEN (secret, read access to the private repo; used at build time) # OPENAI_API_KEY and the other .env values (secrets/variables, used at runtime) FROM python:3.12 LABEL maintainer="insurance_agent" RUN apt-get update && apt-get install -y --no-install-recommends \ git \ build-essential \ && rm -rf /var/lib/apt/lists/* RUN pip install --no-cache-dir uv # Spaces run the container as UID 1000; build as that user so every file # (profiles, active_profile.json, Chroma stores) is writable at runtime. RUN useradd --create-home --uid 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/app/.venv/bin:$PATH \ PYTHONUNBUFFERED=1 \ UV_LINK_MODE=copy \ FASTEMBED_CACHE_PATH=/home/user/app/.cache/fastembed WORKDIR /home/user/app # Bump to force a fresh clone when the Docker layer cache would reuse an old one. ARG REPO_REVISION=1 # Use token to clone the private repo RUN --mount=type=secret,id=GITHUB_TOKEN,mode=0444,required=true \ git clone --depth 1 https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/saghir-abbasi/call_center_demo.git . \ && rm -rf .git RUN uv sync --frozen --no-dev # Build the Chroma vector stores of every agent profile (data/profiles/*/knowledge.*) # at image-build time. This also downloads the fastembed model (~110MB) into # FASTEMBED_CACHE_PATH, so the first runtime call is fast. RUN uv run --no-sync ingest --all EXPOSE 7860 # The browser call page (/app) opens its WebSocket on whatever host served it, # so no DOMAIN_URL override is needed for the port. CMD ["uvicorn", "src.insurance_agent.main:app", "--host", "0.0.0.0", "--port", "7860"]