FROM python:3.12-slim-bookworm
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# git is needed for setuptools-scm version detection in release builds
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*

# Create app directory
WORKDIR /app

# Copy requirements file
COPY uv.lock .
COPY pyproject.toml .

# Install dependencies only (project install needs git for version detection)
RUN uv sync --frozen --no-install-project
ENV PATH="/app/.venv/bin:$PATH"

# Copy app source code
COPY . .

# Install project with placeholder version for CI (real version comes from git tags at release time)
ENV SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0
RUN uv sync --frozen
