# syntax=docker/dockerfile:1
FROM python:3.12-slim AS base

# Install uv.
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

WORKDIR /app

# Install dependencies first for layer caching.
COPY pyproject.toml uv.lock README.md ./
COPY src ./src
RUN uv sync --frozen --no-dev

# Run as a non-root user.
RUN useradd --create-home --uid 10001 pontage
USER pontage

ENV PONTAGE_HOST=0.0.0.0 \
    PONTAGE_PORT=8402
EXPOSE 8402

CMD ["uv", "run", "--no-dev", "python", "-m", "pontage"]
