FROM python:3.12-slim

# uv for fast, reproducible installs
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

WORKDIR /app
COPY pyproject.toml README.md ./
COPY src ./src
RUN uv sync --no-dev --frozen || uv sync --no-dev

# Private premium overlay (not in git / PyPI; uploaded to the host build context).
# Put it on PYTHONPATH so the core server's _load_premium() can import it at startup.
COPY premium ./premium

ENV HOST=0.0.0.0 \
    PORT=8000 \
    KRANKED_CACHE_TTL=3600 \
    PYTHONPATH=/app/premium

EXPOSE 8000

# Serves the streamable-HTTP MCP transport at /mcp
CMD ["uv", "run", "kranked-mcp-serve"]
