FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim

# Pull in Debian security updates the base image lags behind on
# (rebuild with --pull --no-cache to refresh this layer)
RUN apt-get update && apt-get -y upgrade && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# README.md is a build-time input: pyproject declares it, so hatchling
# refuses to build the wheel without it.
COPY pyproject.toml uv.lock README.md LICENSE ./
RUN uv sync --frozen --no-dev --no-install-project

COPY src/ src/
RUN uv sync --frozen --no-dev

EXPOSE 8336

ENV UV_PROJECT_ENVIRONMENT=/app/.venv
# The server itself is PID 1, not a resident `uv run` parent (~40 MiB).
CMD ["/app/.venv/bin/immich-mcp"]
