Shiny_Deploy / Dockerfile
joseph-data's picture
multi-step docker with uv, shiny for python
dbf6004 unverified
raw
history blame contribute delete
877 Bytes
## ------------------------------- Builder Stage ------------------------------ ##
FROM python:3.14-bookworm AS builder
RUN apt-get update && apt-get install --no-install-recommends -y \
build-essential curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
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
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev
## ------------------------------ Production Stage ---------------------------- ##
FROM python:3.14-slim-bookworm AS production
WORKDIR /app
COPY app.py /app/app.py
COPY --from=builder /app/.venv /app/.venv
ENV PATH="/app/.venv/bin:$PATH"
EXPOSE 7860
CMD ["shiny", "run", "app.py", "--host", "0.0.0.0", "--port", "7860"]