# ------------------------------- Builder Stage ------------------------------ multi# FROM python:3.12-bookworm AS builder # System build deps for Python wheels + curl for uv installer RUN apt-get update && apt-get install --no-install-recommends -y \ build-essential curl ca-certificates \ && rm -rf /var/lib/apt/lists/* # Install uv (fast Python package manager) RUN curl -fsSL https://astral.sh/uv/install.sh -o /install.sh \ && chmod 755 /install.sh \ && /install.sh \ && rm -f /install.sh ENV PATH="/root/.local/bin:${PATH}" ENV UV_PROJECT_ENVIRONMENT=/app/.venv WORKDIR /app # Sync locked deps into the project venv (cache uv downloads for faster rebuilds) COPY pyproject.toml uv.lock ./ RUN --mount=type=cache,target=/root/.cache/uv \ uv sync --frozen --no-dev ## ------------------------------ Production Stage ---------------------------- ## FROM python:3.12-slim-bookworm AS production WORKDIR /app # Bring in the prebuilt venv and add it to PATH COPY --from=builder /app/.venv /app/.venv ENV PATH="/app/.venv/bin:$PATH" # Copy only runtime sources/assets COPY app.py ./app.py COPY src ./src #COPY www ./www COPY css ./css # Runtime data files (filtered by .dockerignore) COPY data ./data # Shiny listens on 7860 (HF Spaces) EXPOSE 7860 CMD ["shiny", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]