Bootc Matrix Build
Running a Fedora-based bootc image stack means tracking multiple Fedora releases in parallel. Instead of duplicating every job in the workflow, I wired up the matrix strategy in Forgejo Actions to build F43 and F44 from a single job definition.
The Problem With Hardcoded Versions
Before, every Containerfile had a hardcoded base image:
FROM git.m1ch.eu/oci/c-os:base-43
Supporting F44 would have meant either duplicating the whole workflow or a manual find-and-replace for every release. Neither scales.
Parametrize the Containerfile
First, replace the hardcoded tag with a build arg:
ARG FEDORA_VERSION=43
FROM git.m1ch.eu/oci/c-os:docker-${FEDORA_VERSION}
The default stays 43 so local builds without –build-arg still work.
Add the Matrix
Each job in the orchestrating workflow gets a strategy.matrix block:
jobs:
build_docker_site_a:
strategy:
matrix:
fedora_version: ["43", "44"]
uses: ./.forgejo/workflows/build_and_push.yaml
with:
tag: docker_site_a
dir: docker
fedora_version: ${{ matrix.fedora_version }}
latest_version: ${{ inputs.latest_version || '43' }}
Forgejo spawns one job instance per matrix value. Each produces a distinct tag: docker_site_a-43 and docker_site_a-44.
The latest_version input controls which Fedora version gets the unversioned convenience tag (e.g. docker_site_a). It defaults to 43 and can be overridden at dispatch time when promoting F44 to stable.
The Reusable Workflow
The reusable workflow receives fedora_version as an input and threads it through to podman build:
inputs:
fedora_version:
required: false
default: "43"
type: string
latest_version:
required: false
default: "43"
type: string
...
podman build \
--build-arg FEDORA_VERSION=${{ inputs.fedora_version }} \
-t ${REGISTRY}/${REPO}:${TAG}-${{ inputs.fedora_version }} \
${{ inputs.dir }}
Adding a New Fedora Version
When F45 ships, the change is one line in each build.yaml:
fedora_version: ["43", "44", "45"]
No Containerfile edits needed.
Comments
Talk about this post on Mastodon or Bluesky with #m1ch20260505BootcMatrixBuild.
To comment here, reply to the post on Mastodon or on Bluesky.
Loading comments contacts graz.social or mastodon.social (wherever the post is) and Bluesky, see the privacy policy.