build-python-dockerfiles

Installation
SKILL.md

Build Python Dockerfiles

Use this skill to author Dockerfiles for Python projects using uv and multi-stage builds. The default pattern is based on Hynek Schlawack's article Production-ready Python Docker Containers with uv.

Workflow

  1. Detect whether the project is packaged (installable) or unpackaged (run from copied source).
  2. Choose a base image strategy:
    • Default to python:<version>-slim for generic Python services.
    • Use an OS image like ubuntu:noble when system packages or org-standard base images matter.
    • Keep build and runtime on the same distro family.
    • Avoid Alpine unless the user has a hard requirement.
  3. Install dependencies before copying source so lockfile changes and app code changes stay in separate layers.
  4. Keep dependency sync and app install in separate uv sync steps.
  5. Pick the runtime command pattern that matches the app type.
  6. Verify the final Dockerfile against the checklist in this file.

Required build patterns

Related skills

More from baggiponte/skills

Installs
3
First Seen
Mar 9, 2026