FROM python:3.12-slim

# Git is needed for incremental updates (git diff, git rev-parse)
RUN apt-get update && apt-get install -y --no-install-recommends git \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy project files
COPY pyproject.toml README.md ./
COPY src/ src/

# Install the package
RUN pip install --no-cache-dir .

# Pre-download the embedding model so first run is instant
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"

# ChromaDB data will be stored here — mount a volume for persistence
ENV CODEBASE_QA_CHROMA_PATH=/data/chroma_db

ENTRYPOINT ["codebase-qa-mcp"]
