6.1 KiB
fedora-createrepo-image
Build a Fedora based container image just for creating and building RPM and also APT repo.
By creating and using this container images, it can save time, resources and energy, because it won't need to update package lists and install dependencies every time when it runs.
I mainly use it on all of my RustDesk repos. (Check my profile)
Frequency
Build once a week. When new base images available.
Installed packages
This container includes the following packages:
- RPM/APT repo tools: createrepo_c, reprepro, aptly
- Package building: rpm-build, devscripts, ruby, rubygem-json
- Utilities: jq, wget2, tree, gnupg, git, gh, rpm-sign
- Package repackaging: fpm
For more details, please refer to the Dockerfile.
Tagging
The latest will be latest, and a date (yyyymmdd) tag if you want specific environment or for testing.
Architectures
Just use the latest tag, it will choose the right architecture automatically.
- amd64
- arm64
Use this container in actions
Just add container: ghcr.io/xlionjuan/fedora-createrepo-image:latest after runs-on: ubuntu-24.04-arm, if your workflows doesn't need x86 runners, I recommend using ARM runners because it is using lower footprints.
jobs:
build:
runs-on: ubuntu-24.04-arm # Or ubuntu-latest if you really need x86 runners
container: ghcr.io/xlionjuan/fedora-createrepo-image:latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
.....
.....
Verify the container
The container will be signed with cosign and GitHub Attestations, you can verify the container before you using it in the workflow.
The build also publishes an SPDX JSON SBOM for each architecture image and attaches the same SBOM as both a GitHub SBOM attestation and a cosign SBOM attestation to the pushed image digest. The SBOM is generated from the built container image, so it reflects the RPM packages, Ruby gems, and scripts that are actually present in the image.
For workflows that verify the container before using it, resolve the latest tag to a digest first, verify that immutable digest, and use the same digest in later jobs. This avoids a time-of-check/time-of-use race where latest changes after verification but before the container job starts.
This is an example workflow for verifying the container before using the container.
jobs:
verify:
name: Verify container
runs-on: ubuntu-24.04-arm
outputs:
digest: ${{ steps.get-digest.outputs.digest }}
steps:
# If you want to use cosign to verify the container, you should install cosign first.
# You only need to choose one method
- name: Install Cosign
uses: sigstore/[email protected]
# Resolve the floating tag once, then verify and use this exact digest.
- name: Get image digest
id: get-digest
run: |
set -euo pipefail
digest="$(skopeo inspect --format '{{.Digest}}' docker://ghcr.io/xlionjuan/fedora-createrepo-image:latest)"
test -n "$digest"
echo "Resolved digest: ${digest}"
echo "digest=${digest}" >> "$GITHUB_OUTPUT"
- name: Verify with cosign
run: |
cosign verify --rekor-url=https://rekor.sigstore.dev \
--certificate-identity-regexp "https://github.com/xlionjuan/.*" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
ghcr.io/xlionjuan/fedora-createrepo-image@${{ steps.get-digest.outputs.digest }}
# Optional: verify the SBOM attestation with cosign.
# SBOMs are attached to architecture-specific image digests, not the
# multi-architecture `latest` manifest. Use the tag matching the
# runner architecture, such as `latest-amd64` or `latest-arm64`.
- name: Verify SBOM attestation with cosign (optional)
run: |
cosign verify-attestation \
--type https://spdx.dev/Document/v2.3 \
--certificate-identity-regexp "https://github.com/xlionjuan/.*" \
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
ghcr.io/xlionjuan/fedora-createrepo-image:latest-arm64
# Unfortunately, gh can't do anything without login, even just `gh attestation verify` command
# so it needs to login, but NO any permissions are required.
- name: Verify with gh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh attestation verify --owner xlionjuan oci://ghcr.io/xlionjuan/fedora-createrepo-image@${{ steps.get-digest.outputs.digest }}
# Optional: verify the SBOM attestation with GitHub CLI.
# Like the cosign SBOM check above, this must target an
# architecture-specific image tag or digest.
- name: Verify SBOM attestation with gh (optional)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh attestation verify \
--owner xlionjuan \
--predicate-type https://spdx.dev/Document/v2.3 \
oci://ghcr.io/xlionjuan/fedora-createrepo-image:latest-arm64
build:
runs-on: ubuntu-24.04-arm
needs: verify # So this will only runs if "verify" is passed.
container: ghcr.io/xlionjuan/fedora-createrepo-image@${{ needs.verify.outputs.digest }}
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Do something
run: rpm -qa