# Build stage
FROM python:3.11-slim AS builder

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1

WORKDIR /app

RUN pip install --no-cache-dir uv

COPY pyproject.toml .
RUN uv pip install --system --no-cache -r pyproject.toml

# Final stage
FROM python:3.11-slim

WORKDIR /app

COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin

COPY . .

# Environment variables
ENV APP_NAME="RCA-MCP-Server" \
    LOG_LEVEL="INFO" \
    LOG_FORMAT="json"

EXPOSE 8000

# Default command runs the stdio server
ENTRYPOINT ["python", "-m", "src.rca_mcp.main"]
