From 9dc429d7d8046ea046313362e59eb4a283830ee4 Mon Sep 17 00:00:00 2001 From: Moss Cantwell Date: Tue, 31 Oct 2023 15:48:50 +1300 Subject: [PATCH] feat: add fedora rpmbuild base fedora build for pi --- .github/workflows/build.yml | 17 +++++++++++++++++ README.md | 21 +++++++++++---------- config.yaml | 4 ++++ images/rpmbuild-fedora/Dockerfile | 6 ++++++ 4 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 images/rpmbuild-fedora/Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aefbb38..f8a8e5c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,7 @@ jobs: outputs: matrix-docker: ${{ steps.set.outputs.matrix-docker }} matrix-apko: ${{ steps.set.outputs.matrix-apko }} + matrix-arm: ${{ steps.set.outputs.matrix-arm }} steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - id: set @@ -33,10 +34,12 @@ jobs: run: | echo "matrix-docker=$(jq --arg REF "$REF" -rMc '.build[] | select(.source | contains("Dockerfile")) | select(.buildOnMainOnly == null or $REF == "refs/heads/main") | . as $config | .destination | capture("(?.*)/(?.*):(?.*)") | . as $imgSplit | $config | .source | capture("(?.*)/Dockerfile") | . as $context | $config + $imgSplit + $context' -r -c <<< "$(yq e . -o json config.yaml)" | jq -rcsM '{"include":.}')" >> $GITHUB_OUTPUT echo "matrix-apko=$(jq -rMc '.build[] | select(.source | contains("image.yaml"))' -r -c <<< "$(yq e . -o json config.yaml)" | jq -rcsM '{"include":.}')" >> $GITHUB_OUTPUT + echo "matrix-arm=$(jq --arg REF "$REF" -rMc '.build[] | select(.source | contains("Dockerfile")) | select(.buildOnArm == true) | . as $config | .destination | capture("(?.*)/(?.*):(?.*)") | . as $imgSplit | $config | .source | capture("(?.*)/Dockerfile") | . as $context | $config + $imgSplit + $context' -r -c <<< "$(yq e . -o json config.yaml)" | jq -rcsM '{"include":.}')" >> $GITHUB_OUTPUT - name: check output run: | jq . <<< '${{ steps.set.outputs.matrix-docker }}' jq . <<< '${{ steps.set.outputs.matrix-apko }}' + jq . <<< '${{ steps.set.outputs.matrix-arm }}' build-docker: needs: prepare if: fromJSON(needs.prepare.outputs.matrix-docker) != null @@ -51,6 +54,20 @@ jobs: tags: ${{ fromJSON(toJSON(matrix)).tag }} platforms: linux/amd64 push: ${{ github.ref == 'refs/heads/main' }} + build-arm64: + needs: prepare + if: fromJSON(needs.prepare.outputs.matrix-arm) != null + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.prepare.outputs.matrix-arm) }} + uses: GeoNet/Actions/.github/workflows/reusable-docker-build.yml@main + with: + context: ${{ fromJSON(toJSON(matrix)).context }} + dockerfile: ${{ fromJSON(toJSON(matrix)).source }} + imageName: ${{ fromJSON(toJSON(matrix)).imageName }} + tags: ${{ fromJSON(toJSON(matrix)).tag }} + platforms: linux/arm64 + push: ${{ github.ref == 'refs/heads/main' }} build-apko: needs: prepare if: fromJSON(needs.prepare.outputs.matrix-apko) != null diff --git a/README.md b/README.md index af245e1..ace8641 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ The repo is mostly concerned with base images or images used in build processes. list of vendored base images | Image | Description | -|-----------------------------------------------------------------|--------------------------------------------------------------------------------| +| --------------------------------------------------------------- | ------------------------------------------------------------------------------ | | ghcr.io/geonet/base-images/alpine | standard Alpine base image | | ghcr.io/geonet/base-images/datadog/agent | datadog agent | | ghcr.io/geonet/base-images/debian | standard Debian slim image | @@ -73,6 +73,7 @@ list of vendored base images | ghcr.io/geonet/base-images/rpmbuild-centos7 | image for building RPMs with, based on CentOS 7 | | ghcr.io/geonet/base-images/rpmbuild-centos-stream8 | image for building RPMs with, based on CentOS Stream 8 | | ghcr.io/geonet/base-images/rpmbuild-centos-stream9 | image for building RPMs with, based on CentOS Stream 9 | +| ghcr.io/geonet/base-images/rpmbuild-fedora | image for building RPMs with, based on fedora38 | | ghcr.io/geonet/base-images/yq | yq for GitHub actions | | ghcr.io/geonet/base-images/binfmt | Cross-platform emulator collection distributed with Docker images | | 862640294325.dkr.ecr.ap-southeast-2.amazonaws.com/datadog-agent | datadog agent for use in ECS | @@ -331,16 +332,16 @@ PACKAGE: # Tooling -| Name | Description | Links | Related/Alternatives | -|---------|-------------------------------------------------------------------------------|--------------------------------------------------------------------|------------------------------------------| -| crane | an officially supported cli container registry tool from Google | | skopeo | -| yq | a cli YAML parser | | jq | -| cosign | a cli container image artifact signing utility by Sigstore (Linux Foundation) | | ... | -| melange | a cli Alpine APK package declarative builder supported by Chainguard | | ... | +| Name | Description | Links | Related/Alternatives | +| ------- | ----------------------------------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------------------ | +| crane | an officially supported cli container registry tool from Google | | skopeo | +| yq | a cli YAML parser | | jq | +| cosign | a cli container image artifact signing utility by Sigstore (Linux Foundation) | | ... | +| melange | a cli Alpine APK package declarative builder supported by Chainguard | | ... | | apko | a cli tool for declaratively building Alpine based container images | | ko ( - Linux Foundation) | -| docker | a container ecosystem, primarily for development | | podman | -| trivy | a container image scanner | | clair | -| syft | a cli tool to generate sboms based on container images and filesystems | | | +| docker | a container ecosystem, primarily for development | | podman | +| trivy | a container image scanner | | clair | +| syft | a cli tool to generate sboms based on container images and filesystems | | | # Patterns for discussion diff --git a/config.yaml b/config.yaml index e0b850c..61cc23c 100644 --- a/config.yaml +++ b/config.yaml @@ -125,3 +125,7 @@ build: - source: ./images/rpmbuild-centos-stream9/Dockerfile destination: ghcr.io/geonet/base-images/rpmbuild-centos-stream9:latest buildOnMainOnly: true + - source: ./images/rpmbuild-fedora/Dockerfile + destination: ghcr.io/geonet/base-images/rpmbuild-fedora:latest + buildOnMainOnly: true + buildOnArm: true diff --git a/images/rpmbuild-fedora/Dockerfile b/images/rpmbuild-fedora/Dockerfile new file mode 100644 index 0000000..2c3e5a0 --- /dev/null +++ b/images/rpmbuild-fedora/Dockerfile @@ -0,0 +1,6 @@ +FROM ghcr.io/geonet/base-images/fedora:38 +# Installing tools needed for rpmbuild +RUN dnf update -y && \ + dnf install -y \ + rpm-build rpmdevtools rpm-sign rpmlint git dnf-plugins-core nodejs npm make automake gcc \ + gcc-c++ kernel-devel python3 glibc systemd openssl fontconfig-devel freetype freetype-devel boost