# RAG Agent app. Build from repo root (clone git@git.lesha.spb.ru:alex/RagAgent.git then docker compose build).
FROM python:3.12-slim

WORKDIR /app

# Install git for optional in-image clone; app is usually COPY'd from build context
RUN apt-get update -qq && apt-get install -y --no-install-recommends git openssh-client \
    && rm -rf /var/lib/apt/lists/*

# Copy repo (when built from cloned repo: docker compose build)
COPY pyproject.toml ./
COPY src ./src
COPY README.md ./

RUN pip install --no-cache-dir -e .

# Default: run webhook server (override in compose or when running)
ENV RAG_DB_DSN=""
ENV RAG_REPO_PATH="/data"
EXPOSE 8000
ENTRYPOINT ["rag-agent"]
CMD ["serve", "--host", "0.0.0.0", "--port", "8000"]
