Home
A pyrig plugin to integrate containers.
Overview
pyrig-containers integrates containers into a pyrig-managed project through three
pieces: generation of a Containerfile, container tooling registered in the rig,
and an automated step that publishes the image to the GitHub Container Registry
(GHCR) on release. This page describes each piece; see the API Reference for the
generated, code-level documentation.
uv add pyrig-containers --dev
uv run pyrig sync
If you want to locally build images or do other container actions you will need to install podman locally as well.
Components
Containerfile generation
ContainerfileConfigFile generates a Containerfile at the project root. It
starts from a slim Python base image matching the highest Python version the
project supports, then copies in the uv binary — sourced via a
PackageManager override (container_image) that supplies the image and its
paths — followed by the project's metadata and lock file. After creating a
non-root appuser (UID 1000) and giving it ownership of the copied files, it
switches to that user, copies in the source tree, installs only
non-development dependencies with uv, and removes the now-unneeded metadata
files. The entrypoint runs the project with uv run <project-name>. Podman is
the only container engine this Containerfile is verified against — see below.
Container engine
ContainerEngine wraps Podman. It provides the command arguments used to
authenticate with a registry, to build and tag an image from the
Containerfile, and to push an individual tag. It contributes a Podman
badge to the project's README.
Container registry
ContainerRegistry models the GitHub Container Registry. It owns the registry host
(ghcr.io), composes the project's lowercased image name
(ghcr.io/<owner>/<project>, since GHCR requires lowercase names), and builds
tagged image references from it. It contributes a GHCR badge to the
project's README.
Deploy workflow
The deploy workflow is extended with a container-image job. After a successful
release it installs Podman, logs in to GHCR using the workflow actor and the
automatic GITHUB_TOKEN, builds the image from the Containerfile, and pushes it
under two tags: the released version (:<version>) and :latest.
API Reference
For class- and method-level details, see the API Reference, which is generated automatically from the source.