# syntax=docker/dockerfile:1 FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS base WORKDIR /app ENV UV_COMPILE_BYTECODE=1 ENV UV_LINK_MODE=copy # Install dependencies first (cache layer) COPY pyproject.toml ./ RUN --mount=type=cache,target=/root/.cache/uv \ uv pip install --system -r pyproject.toml # Copy source COPY . . # --- Development (editable install for hot reload) --- FROM base AS dev RUN --mount=type=cache,target=/root/.cache/uv \ uv pip install --system --no-deps -e . CMD ["uvicorn", "orrery_search.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload", "--proxy-headers", "--forwarded-allow-ips", "*"] # --- Production (non-editable, non-root) --- FROM base AS prod RUN --mount=type=cache,target=/root/.cache/uv \ uv pip install --system --no-deps . RUN adduser --disabled-password --gecos "" orrery && \ mkdir -p /data && chown -R orrery:orrery /data USER orrery CMD ["uvicorn", "orrery_search.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "2", "--proxy-headers", "--forwarded-allow-ips", "*"]