From 47cac32de521dd5f368d576a9deb9f3279b41783 Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Sat, 1 Apr 2023 16:42:10 -0700 Subject: [PATCH] Add multi-arch GitHub Workflow to build/push container image * Explore using GitHub Workflows for multi-arch container image builds, instead of using the internal Drone server --- .github/workflows/build.yaml | 8 +++ .github/workflows/multi-arch.yaml | 81 +++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/multi-arch.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..ca624a4 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,8 @@ +name: multi-arch +on: + push: +jobs: + multi-arch: + uses: ./.github/workflows/multi-arch.yaml + secrets: + QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} diff --git a/.github/workflows/multi-arch.yaml b/.github/workflows/multi-arch.yaml new file mode 100644 index 0000000..69e7d06 --- /dev/null +++ b/.github/workflows/multi-arch.yaml @@ -0,0 +1,81 @@ +name: multiarch-image-app +on: + workflow_call: + secrets: + QUAY_TOKEN: + description: 'Quay Registry push token' + required: false +jobs: + build-amd64: + name: build-amd64 + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + # Checkout repo to GitHub Actions runner + - name: Checkout + uses: actions/checkout@v3 + + - name: Build Image + run: make image-amd64 + + - name: Quay Token + if: env.QUAY_TOKEN != null + env: + QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} + run: | + buildah login -u "poseidon+workflow" -p "$QUAY_TOKEN" quay.io + + - name: Push Image + if: github.ref == 'refs/heads/main' + run: | + make push-amd64 + + build-arm64: + name: build-arm64 + runs-on: ubuntu-latest + steps: + # Checkout repo to GitHub Actions runner + - name: Checkout + uses: actions/checkout@v3 + + - name: QEMU packages + run: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + + - name: Build Image + run: make image-arm64 + + - name: Quay Token + if: env.QUAY_TOKEN != null + env: + QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} + run: | + buildah login -u "poseidon+workflow" -p "$QUAY_TOKEN" quay.io + + - name: Push Image + if: github.ref == 'refs/heads/main' + run: | + make push-arm64 + + manifest: + name: manifest + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + needs: + - build-amd64 + - build-arm64 + steps: + # Checkout repo to GitHub Actions runner + - name: Checkout + uses: actions/checkout@v3 + + - name: Quay Token + if: env.QUAY_TOKEN != null + env: + QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} + run: | + buildah login -u "poseidon+workflow" -p "$QUAY_TOKEN" quay.io + + - name: Push Multi-Arch + run: make manifest