FROM python:3.13-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*

COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

WORKDIR /app
COPY pyproject.toml ./
COPY voice_mcp ./voice_mcp
RUN uv sync

# Bake the embedding model into the image so the first call doesn't have to
# download it (and so it works offline).
RUN uv run python -c "from fastembed import TextEmbedding; TextEmbedding('BAAI/bge-small-en-v1.5')"

# The private RAG index lives on a Railway volume mounted at /data and is
# uploaded out-of-band (never in git): build locally with `voice-mcp-index
# build ~/voice-corpora`, then push rag_index.pkl to the volume.
ENV VOICE_INDEX=/data/rag_index.pkl
ENV MCP_TRANSPORT=http
ENV PORT=8000
EXPOSE 8000

CMD ["uv", "run", "voice-mcp"]
