From 531e4851c6842b0153046280a82b438572d4e304 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 4 Nov 2023 09:52:56 -0400 Subject: [PATCH] builder: New container image This will be the container image buildroot. TODO: Build this using RHTAP too --- .github/workflows/builder.yml | 40 +++++++++++++++++++++++++++++++++++ builder/Containerfile | 5 +++++ builder/build.sh | 20 ++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 .github/workflows/builder.yml create mode 100644 builder/Containerfile create mode 100755 builder/build.sh diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml new file mode 100644 index 00000000..643063dd --- /dev/null +++ b/.github/workflows/builder.yml @@ -0,0 +1,40 @@ +name: builder + +on: + push: + paths: + - builder/** + pull_request: + branches: + - main + paths: + - builder/** + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository_owner }}/builder + +jobs: + build-image: + runs-on: ubuntu-latest + + steps: + - name: Install qemu dependency + run: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + - name: Checkout repository + uses: actions/checkout@v3 + - name: Login + run: buildah login --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} ${{ env.REGISTRY }} + - name: Build + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: latest + containerfiles: ./builder/Containerfile + archs: s390x, arm64, amd64, ppc64le + oci: true + context: builder + - name: Push + run: buildah push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} diff --git a/builder/Containerfile b/builder/Containerfile new file mode 100644 index 00000000..6ac388f6 --- /dev/null +++ b/builder/Containerfile @@ -0,0 +1,5 @@ +# This image contains the baseline tools to build bootable base images. +FROM quay.io/centos/centos:stream9 +COPY . /src +RUN /src/build.sh && cd / && rm /src -rf + diff --git a/builder/build.sh b/builder/build.sh new file mode 100755 index 00000000..9cc478ac --- /dev/null +++ b/builder/build.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -xeuo pipefail + +pkginstall() { + dnf -y install "$@" +} + +pkginstall dnf-utils +dnf config-manager --set-enabled crb +# Sadly there's no EPEL for s390x so we just hardcode this for now, it's noarch. +dnf -y install https://kojipkgs.fedoraproject.org//packages/distribution-gpg-keys/1.98/1.el9/noarch/distribution-gpg-keys-1.98-1.el9.noarch.rpm +# rpm-ostree for builds, and need skopeo to do the container backend +pkginstall rpm-ostree skopeo +# For derived container builds +pkginstall buildah +# And a rust toolchain +pkginstall cargo openssl-devel + +# Build tools +pkginstall selinux-policy-targeted osbuild crypto-policies-scripts sudo