Spaces:
Sleeping
Sleeping
File size: 1,345 Bytes
9a77722 a6c2f7a 69a3b98 a6c2f7a 69a3b98 a6c2f7a 69a3b98 a6c2f7a 69a3b98 a6c2f7a 69a3b98 a6c2f7a 69a3b98 a6c2f7a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # ------------------------------- 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"]
|