ci: Add a Containerfile-based workflow

This is a small but notable step towards making the build
process more container native.  The rpm-ostree bits
are hidden much more.  We use a special trick
specific to podman/buildah to do `FROM oci-archive`
on an oci-archive that was built in a previous image
stage.

This lets us do things not possible in a Containerfile
that is basically about total control over the image
layers:

 - Output content-addressed reproducible "chunked" layers
 - Choose whether or not to use zstd for layers

See discussion in e.g.
https://github.com/coreos/rpm-ostree/issues/4688

Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
Colin Walters 2024-03-23 11:16:20 -04:00
parent 8238f083a8
commit 257c791461
2 changed files with 57 additions and 6 deletions

View file

@ -13,10 +13,6 @@ jobs:
build-image:
runs-on: ubuntu-latest
container:
image: quay.io/centos-bootc/bootc-image-builder:latest
options: --privileged
# Yes, this is a one-element matrix, but we may add c10s in the future soon
strategy:
matrix:
@ -26,10 +22,24 @@ jobs:
version: stream9
steps:
- name: Update podman
run: |
# from https://askubuntu.com/questions/1414446/whats-the-recommended-way-of-installing-podman-4-in-ubuntu-22-04
ubuntu_version='22.04'
key_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key"
sources_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}"
echo "deb $sources_url/ /" | sudo tee /etc/apt/sources.list.d/devel-kubic-libcontainers-unstable.list
curl -fsSL $key_url | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null
sudo apt update
sudo apt install -y podman
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Build
run: |
rpm-ostree compose image --format=ociarchive \
--initialize ${{ matrix.os }}-bootc.yaml dest.oci-archive
podman build --security-opt=label=disable --cap-add=all --device /dev/fuse \
-t localhost/${{ matrix.os }}-${{ matrix.version }}-bootc -f Containerfile.${{ matrix.os }}-${{ matrix.version }}
- name: Run image
run: podman run --rm -ti localhost/${{ matrix.os }}-${{ matrix.version }}-bootc bootc --help