This directory contains bootc images and a GitHub Actions workflow (.github/workflows/build.yml) that builds bootc images for multiple platforms and creates installable artifacts (ISOs, disk images, etc.). It is based on this one
The images and artifacts are pushed to the GitHub Container Registry (GHCR) by default, but can be configured to push to any container registry.
This workflow uses a subscribed UBI container approach, which eliminates the need to handle Red Hat subscriptions within your Containerfile. The subscription is managed at the workflow level, making your Containerfile cleaner and more secure.
Store your images in designated folders within the repository's root directory. The workflow will automatically rebuild images whenever changes are detected in those folders.
Note: if only blacklisted files change in a directory (currently
.buildconfigandREADME.md, matched case-insensitively), the build for that directory is skipped — this lets you tweak configuration comments or docs without triggering a rebuild. Any other file change (including the Containerfile itself) triggers a normal build.
-
Setup
- Reads input parameters or defaults
- Detects changed directories with Containerfiles (skipping directories where only blacklisted files —
.buildconfig,README.md— changed) - Generates build matrices for images and artifacts
- Checks existing artifacts to avoid redundant builds
-
Build Images
- Runs in a subscribed UBI9 container with container tools installed
- Registers with Red Hat using credentials or activation keys
- Uses
buildahto build multi-platform bootc images - Passes
ARGbuild arguments declared in.buildconfig - Mounts build-time secrets declared in the workflow for use via
--mount=type=secret - Creates semantic version tags (v1, v2, v3, etc.)
- Automatically unregisters subscription when complete
-
Build Artifacts (Optional)
- Uses
image-builder(ghcr.io/osbuild/image-builder) to create installable artifacts — this replaces the now-deprecatedbootc-image-builder - Supports custom artifact configuration via optional
config.tomlfiles, passed explicitly as a--blueprint - ISO-style formats (
bootc-generic-iso,bootc-installer) additionally build a per-app Anaconda installer image on top of a shared base (see Installer Base Images below), and optionally inject a kickstart into the resulting ISO withmkksiso(seeinject_kickstart) - Packages artifacts into container images for easy distribution
- Supports multiple formats and platforms simultaneously
- Uses
-
Multi-Platform Manifest
- Creates unified multi-arch container image manifests
- Supports both x86_64 and ARM64 architectures
-
Push
- Pushes container images and artifact images to the configured registry
Choose one authentication method:
Username/Password:
RH_USERNAME: Your Red Hat usernameRH_PASSWORD: Your Red Hat password
OR Organization/Activation Key:
RHT_ORGID: Your Red Hat organization IDRHT_ACT_KEY: Your Red Hat activation key
Repository Variables:
DEST_REGISTRY_HOST: Destination registry (default:ghcr.io)DEST_REGISTRY_USER: Registry username (default: repository owner)INSTALLER_BASE: Repo-wide defaultinstaller_base(see Installer Base Images) used when a directory has no.buildconfigor noinstaller_basekey (default:anaconda-rhel10-base)
Repository Secrets:
DEST_REGISTRY_PASSWORD: Registry password (default: GitHub token)SOURCE_REGISTRY_USER: Source registry username overrideSOURCE_REGISTRY_PASSWORD: Source registry password override
Optional Parameters:
BASE_PATH: Path where the image definitions are located in the repo (defaults to "/")IMAGE_PREFIX: Prefix that will be included in the container image names (defaults to "bootc")
If you want to create your own GitHub repository for building bootc images follow this steps:
Once it is created place the .github/workflows/build.yml at the root of your repository:
.github/workflows/build.yml
If it's placed elsewhere, GitHub Actions will not detect it.
Then create directories at the root level with your different images. Example directory structure:
Note: More information about the .buildconfig in a section below.
my-arm64-only-image/
├── Containerfile
├── config.toml
├── .buildconfig
└── other-files...
my-image-with-iso-artifact/
├── Containerfile
├── .buildconfig (needs installer_base: <name>)
└── installer/
├── Containerfile (FROM the shared installer base)
├── kickstart.ks
└── iso.yaml
my-minimal-image/
├── Containerfile
└── other-files...
Alternatively you can also fork this repository and remove the directories with the images.
To allow the workflow to read repository contents and push packages:
- Go to Repository Settings → Actions → General.
- Scroll to Workflow permissions.
- Select:
- ✅ Read repository contents and packages permissions
- Click Save.
The workflow supports two authentication methods with Red Hat:
- Go to Repository Settings → Secrets and variables → Actions.
- Add the following Repository secrets:
RH_USERNAME: Your Red Hat usernameRH_PASSWORD: Your Red Hat password
If you prefer to use activation keys:
- Add these Repository secrets instead:
RHT_ORGID: Your Red Hat organization IDRHT_ACT_KEY: Your Red Hat activation key
The workflow will automatically detect which method to use based on available secrets.
By default, images are pushed to GitHub Container Registry (GHCR). To use a different registry:
- Go to Repository Settings → Secrets and variables → Actions.
- Under Variables, add any of:
DEST_REGISTRY_HOST: Custom registry hostname (default:ghcr.io)DEST_REGISTRY_USER: Custom registry username (default:github.repository_owner)
- Under Secrets, add:
DEST_REGISTRY_PASSWORD: Custom registry password (default:GITHUB_TOKEN)
If you need different credentials for pulling from registry.redhat.io:
- Add these Repository secrets:
SOURCE_REGISTRY_USER: Registry username (defaults toRH_USERNAME)SOURCE_REGISTRY_PASSWORD: Registry password (defaults toRH_PASSWORD)
- Go to Repository Settings → Secrets and variables → Actions.
- Under Variables, add any of these that you want to override:
BASE_PATH: Path where the image definitions are located in the repo (defaults to "/")IMAGE_PREFIX: Prefix that will be included in the container image names (defaults to "bootc")INSTALLER_BASE: Defaultinstaller_basefor ISO formats (defaults to "anaconda-rhel10-base")
Built images and artifacts are available in your repository's Packages section:
https://github.com/{username}/{repository}/pkgs/container/{image-name}
- Bootc Images:
ghcr.io/{owner}/bootc-{directory}:latest - Artifact Images:
ghcr.io/{owner}/bootc-{directory}-{format}:latest - Version Tags: All images also have
vNtags (v1, v2, v3, etc.)
If your directory is named myimage:
- Bootc image:
ghcr.io/myorg/bootc-myimage:latest - ISO artifact:
ghcr.io/myorg/bootc-myimage-bootc-generic-iso:latest - QCOW2 artifact:
ghcr.io/myorg/bootc-myimage-qcow2:latest
The workflow can create the following installable formats, using image-builder:
bootc-generic-iso- Generic Anaconda installer ISO (default, preferred ISO format — see the warning below)bootc-installer- Anaconda installer ISO with the bootc image embedded in the ISO itselfqcow2- QEMU disk imagevmdk- VMware disk imageraw- Raw disk imageami- Amazon Machine Imagevhd- Hyper-V disk imagegce- Google Compute Engine image
Note:
anaconda-iso(the oldbootc-image-builderformat name) is no longer supported. The workflow automatically remaps anyanaconda-isovalue tobootc-installerfor backward compatibility, but you should update.buildconfig/workflow inputs to usebootc-generic-isoorbootc-installerdirectly.
bootc-generic-iso and bootc-installer both require an installer_base — see Installer Base Images.
The workflow creates two types of outputs:
- Bootc container images:
ghcr.io/{owner}/bootc-{directory}:latest - Artifact container images:
ghcr.io/{owner}/bootc-{directory}-{format}:{label}(when artifacts are built)
Note: Check in the Packages section in the repo the available images.
To extract installable artifacts (ISOs, disk images, etc.) from the artifact container images:
# Example: Extract a bootc-generic-iso artifact
mkdir artifacts
podman create --name temp-container ghcr.io/{owner}/bootc-{directory}-{format}:{label}
podman cp temp-container:/ ./artifacts/
podman rm temp-container
podman rmi ghcr.io/{owner}/bootc-{directory}-{format}:{label}
# The installable files will be in ./artifacts/
ls -la artifacts/You can control build behavior by adding a .buildconfig file to any image directory:
# Restrict platforms (default: linux/amd64,linux/arm64)
platforms: linux/arm64
# Control artifact creation
artifacts: true|false|auto # default: auto (create if none exist)
# Specify artifact formats (default: bootc-generic-iso)
artifact_formats: bootc-generic-iso,bootc-installer,qcow2,vmdk
# Required for bootc-generic-iso / bootc-installer formats (see Installer
# Base Images below). Falls back to the repo-wide default (vars.INSTALLER_BASE
# or the workflow_dispatch input) if omitted.
installer_base: anaconda-rhel10-base
# Inject installer/kickstart.ks into ISO artifacts (bootc-generic-iso,
# bootc-installer) with mkksiso before pushing (default: true)
inject_kickstart: true
# Reuse the same version tag instead of incrementing (default: false)
keep_version: false
# Pass ARG values to buildah at build time (repeat the line for multiple args)
build_args: MY_ARG=some_value
build_args: ANOTHER_ARG=other_valueRestricts which architectures the image (and its artifacts) are built for.
# Build only for ARM64
platforms: linux/arm64# Build only for AMD64
platforms: linux/amd64# Build for both (same as omitting this option)
platforms: linux/amd64,linux/arm64Controls whether installable artifacts (e.g. ISO, qcow2) are created from the image.
# Always create artifacts on every build
artifacts: true
# Never create artifacts
artifacts: false
# Create artifacts only if none exist yet in the registry (default)
artifacts: autoWhen artifacts: true or artifacts: auto, you can specify which formats to build:
artifacts: true
artifact_formats: bootc-generic-iso,qcow2Supported formats: bootc-generic-iso, bootc-installer, qcow2, vmdk, raw, ami, vhd, gce
Required when artifact_formats includes bootc-generic-iso and/or bootc-installer. Names an image built under _base_anaconda_images_/<name>/ (a shared Anaconda installer environment, no kickstart). The workflow pulls that base image, then builds this directory's own installer/Containerfile on top of it to produce a local, per-app installer image used as --bootc-ref by image-builder.
installer_base: anaconda-rhel10-baseIf omitted, the repo-wide default is used (vars.INSTALLER_BASE, or the workflow_dispatch installer_base input — both default to anaconda-rhel10-base). See Installer Base Images for the full setup.
Note: embedding the payload in
bootc-generic-isoYou can still get a fully offline-capable
bootc-generic-isoby passing--bootc-installer-payload-ref <image>directly toimage-builder(this repo's workflow does not do this automatically forbootc-generic-iso, see the overlay-over-overlayfs issue above). When you do, the referenced image is copied into/var/lib/containers/storageinside the ISO's squashfs, so it is available locally at install time.Two things to get right when using this:
kickstart.ksmust point at the local copy.--source-imgrefhas to use thecontainers-storage:transport with the exact same reference, tag included, that you passed to--bootc-installer-payload-ref, e.g.--source-imgref=containers-storage:ghcr.io/owner/myimage:latest-amd64. If you leave it as--source-imgref=registry:...,bootc installignores the embedded copy and always pulls over the network. This is easy to miss: with network access at install time it just works, silently ignoring the embedded payload, but on an isolated network the install can finish and reboot without ever deploying the OS. The disk ends up with no bootloader, and the machine hangs at "Booting from Hard Disk..." (or shows "No bootable option or device was found" in UEFI) after reboot.- Give the install VM enough RAM, not disk. Importing the embedded payload into ostree needs scratch space under
/var/tmpin the live installer environment, which lives in the installer's RAM/tmpfs, not on the target disk. If the VM does not have enough memory you will seebootc install ...: no space left on devicewhile writing to/var/tmp/container_images_...in the bootc log, even though the target disk has plenty of free space. Size the install VM's RAM comfortably above the embedded image size.
Only relevant for ISO-style formats (bootc-generic-iso, bootc-installer), and ignored for other formats since they have no ISO to inject into.
When true (the default), after image-builder produces the ISO the workflow installs lorax (for mkksiso) and re-injects installer/kickstart.ks from your image directory directly into the ISO, replacing the copy image-builder already baked in via the installer image. Set it to false to skip this step and ship the ISO exactly as image-builder produced it.
inject_kickstart: falseIf no
.isofile is found in the build output for the format being built, this step is skipped with a warning rather than failing the build.
By default, each build increments the version tag (v1 → v2 → v3...).
Set keep_version: true to always overwrite the current version instead of creating a new one.
Useful for images that are frequently rebuilt but don't need a full version history.
keep_version: truePasses build-time ARG values to buildah. These are equivalent to --build-arg KEY=VALUE
and are available in your Containerfile via ARG KEY.
# Single arg
build_args: BASE_IMAGE=registry.example.com/mybase:latest
# Multiple args — repeat the line
build_args: BASE_IMAGE=registry.example.com/mybase:latest
build_args: APP_VERSION=2.1.0Then reference them in your Containerfile:
ARG BASE_IMAGE=registry.redhat.io/rhel9/rhel-bootc:9.7
ARG APP_VERSION
FROM ${BASE_IMAGE}
RUN echo "Building version ${APP_VERSION}"Note: Do not use
build_argsfor sensitive values like passwords or tokens. Use build-time secrets instead (see below).
Secrets allow sensitive values (tokens, passwords, credentials) to be available during the build without being baked into the image layers or appearing in build logs.
Secrets are not configured in .buildconfig. They are declared once in the workflow
file and automatically mounted for every build. Containerfiles that do not reference a
secret simply ignore it.
Each secret is:
- Read from a GitHub Actions repository secret
- Written to a temporary file during the build
- Mounted into the build environment via
--secret id=<name>,src=<file> - Deleted immediately after the build step completes
- Never written into any image layer
The secret value is redacted in build logs (shown as ***). The file you copy into
the image (e.g. /etc/mysecrets/token) will be present in the final image — only the
build-time mount mechanism itself is ephemeral.
The workflow already declares (and mounts, when non-empty) the following secrets out of the box. You only need to create the matching GitHub repository secret with the same name — no workflow edits required to use any of these:
| Secret ID (as used in Containerfile) | GitHub repository secret |
|---|---|
GITLAB_TOKEN |
GITLAB_TOKEN |
REGISTRY_TOKEN |
REGISTRY_TOKEN |
PULL_SECRET |
PULL_SECRET |
WIFI_SSID |
WIFI_SSID |
WIFI_PASSWORD |
WIFI_PASSWORD |
If you only need one of the above, skip straight to step 1 below (create the GitHub secret) and use it in your Containerfile (step 3) — steps for editing the workflow are only needed when you want to add a new secret name that isn't in this list.
To wire up a new secret, three things need to be in place:
1. Create the secret in GitHub
Go to Repository Settings → Secrets and variables → Actions and add a new
repository secret, e.g. MY_OTHER_SECRET.
2. Add it to the workflow env: block and mount script
In .github/workflows/build.yml, find the Build platform-specific image with Buildah
step and add two blocks — one in env: and one in the secret mount section:
env:
SECRET_GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
SECRET_REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
SECRET_PULL_SECRET: ${{ secrets.PULL_SECRET }}
SECRET_WIFI_SSID: ${{ secrets.WIFI_SSID }}
SECRET_WIFI_PASSWORD: ${{ secrets.WIFI_PASSWORD }}
# Add one line per new secret:
SECRET_MY_OTHER_SECRET: ${{ secrets.MY_OTHER_SECRET }}if [ -n "${SECRET_MY_OTHER_SECRET:-}" ]; then
printf '%s' "$SECRET_MY_OTHER_SECRET" > "$SECRET_TMPDIR/MY_OTHER_SECRET"
SECRET_FLAGS+=(--secret "id=MY_OTHER_SECRET,src=$SECRET_TMPDIR/MY_OTHER_SECRET")
echo " Mounting secret: MY_OTHER_SECRET"
fi
# Copy this block for each additional secret3. Use it in your Containerfile
# The secret is available as a file at /run/secrets/<id>
RUN --mount=type=secret,id=GITLAB_TOKEN \
git clone https://oauth2:$(cat /run/secrets/GITLAB_TOKEN)@gitlab.com/myorg/myrepo.git /src
# You can also copy the secret into the image (it will persist in the final image)
RUN --mount=type=secret,id=GITLAB_TOKEN \
mkdir -p /etc/myapp && \
cp /run/secrets/GITLAB_TOKEN /etc/myapp/token && \
chmod 600 /etc/myapp/tokenImportant:
/run/secrets/<id>is a file, not a directory. Do not add a trailing slash:cat /run/secrets/GITLAB_TOKEN✅ls /run/secrets/GITLAB_TOKEN/❌Note: secrets declared this way are only mounted in the
build-imagejob (thebuildah buildstep). They are not available tobuild-artifacts/image-builder.
You can customize installable artifacts by adding an optional config.toml file to any image directory. This file is passed to image-builder as a blueprint (--blueprint /config.toml) to configure the artifact creation process. Unlike the old bootc-image-builder, image-builder does not auto-mount a config.toml — the workflow only mounts and passes it when the file exists.
The config.toml file supports various configuration options such as:
- User accounts and SSH keys
- Filesystem customizations
- Network configuration
- Package installation/removal
- System services configuration
- And other
image-builderblueprint options
Important: The config.toml file is completely optional. If it doesn't exist, artifacts will be created with default settings.
Here's an example config.toml file that creates a user account with sudo access:
[[customizations.user]]
name = "admin"
password = "redhat"
groups = ["wheel"]Or the same file but with the password encrypted with openssl passwd -6 "redhat"
[[customizations.user]]
name = "admin"
password = "$6$/7rTITXmb1xpkB52$1L6xl53aTMayMIqhdxh6VxLGguy2CUxxf50oqcJGElUgcyx/8nTIEBKtvP6erLtwwLS5B6ZyCEDkrZMGC8ydN/"
groups = ["wheel"]For more configuration options, consult the image-builder documentation.
You can manually trigger builds with custom parameters:
- Go to Actions → Build bootc images
- Click Run workflow
- Configure:
- Platforms:
linux/amd64,linux/arm64(or subset) - Formats:
bootc-generic-iso,bootc-installer,qcow2,vmdk(or subset) - Installer base: name of an image under
_base_anaconda_images_/<name>/, used as the default for directories with noinstaller_basein their.buildconfig(default:anaconda-rhel10-base)
- Platforms:
This workflow uses GitHub's free hosted runners, which have limited disk space.
When creating installable artifacts, especially larger formats like raw disk images, you may encounter disk space limitations that cause the workflow to fail.
If you experience disk space failures during artifact creation, consider these alternatives:
-
Create artifacts externally: Use the generated bootc images from this workflow to create installable artifacts on your own system with more disk space. You might find useful the RHEL and non-RHEL examples in this repository.
-
Use self-hosted runners: Set up your own GitHub Actions runners with more disk space and configure the workflow to use them.
-
Upgrade to larger GitHub runners: GitHub offers larger runners with more disk space as part of their paid plans. You can configure the workflow to use these by updating the runner specifications in the build matrix.