/uv-features:uv-dockerfrom uv-features
Guide uv-based multi-stage Dockerfile builds. Use when writing a Dockerfile that installs Python deps via uv.
Ships in uv-features. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use multi-stage builds with uv. The final image should NOT contain uv — only the installed venv.
# Stage 1: Build
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy UV_NO_DEV=1 UV_PYTHON_DOWNLOADS=0
WORKDIR /app
# Install dependencies first (cached layer)
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --locked --no-install-project
# Copy source and install project
COPY . /app
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked
# Stage 2: Runtime (no uv, no build tools)
# IMPORTANT: Use the same Python version as the builder
FROM python:3.12-slim-bookworm
RUN groupadd --system --gid=999 nonroot \
&& useradd --system --gid=999 --uid=999 --create-home nonroot
COPY --from=builder --chown=nonroot:nonroot /app /app
ENV PATH="/app/.venv/bin:$PATH"
USER nonroot
WORKDIR /app
CMD ["python", "main.py"]
Key points:
UV_COMPILE_BYTECODE=1 — pre-compile .pyc for faster startupUV_LINK_MODE=copy — required when cache mount is on a different filesystemUV_PYTHON_DOWNLOADS=0 — use system Python, no managed downloadsUV_NO_DEV=1 — omit development dependencies--locked — ensure lockfile is up-to-date, fail otherwise.venv
__pycache__
If more detail is needed, consult:
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub pokutuna/claude-plugins --plugin uv-features3 skills in this plugin