From aea80a48a69cdc59cc7f1844e6b341e4d8f7ddd0 Mon Sep 17 00:00:00 2001 From: Ric Harvey Date: Tue, 5 Nov 2024 16:19:48 +0000 Subject: [PATCH] Try multiarch build --- .forgejo/workflows/build.yml | 30 ++++++++++++ .forgejo/workflows/matrix-build.yml | 75 ----------------------------- 2 files changed, 30 insertions(+), 75 deletions(-) create mode 100644 .forgejo/workflows/build.yml delete mode 100644 .forgejo/workflows/matrix-build.yml diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml new file mode 100644 index 0000000..f651623 --- /dev/null +++ b/.forgejo/workflows/build.yml @@ -0,0 +1,30 @@ +name: ci + +on: + push: + +env: + REGISTRY_IMAGE: richarvey/mailhog + +jobs: + docker: + runs-on: docker + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 + push: true + tags: ${{ env.REGISTRY_IMAGE }}:latest diff --git a/.forgejo/workflows/matrix-build.yml b/.forgejo/workflows/matrix-build.yml deleted file mode 100644 index fb5251d..0000000 --- a/.forgejo/workflows/matrix-build.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: docker - -on: - push: - tags: - - "v*" - -env: - DOCKER_REPO: richarvey/mailhog - -jobs: - build: - timeout-minutes: 30 - - strategy: - matrix: - platform: - - linux/amd64 - - linux/arm64 - - linux/arm/v6 - - linux/arm/v7 - - steps: - - name: Set vars - id: vars - run: | - echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - echo "platform=$(echo -n ${{ matrix.platform }} | sed 's/\//-/g')" >> $GITHUB_OUTPUT - - - uses: actions/checkout@v3 - - uses: docker/setup-qemu-action@v3 - - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build docker images - uses: docker/build-push-action@v5 - with: - context: . - push: true - platforms: ${{ matrix.platform }} - tags: | - ${{ env.DOCKER_REPO }}:${{ steps.vars.outputs.version }}-${{ steps.vars.outputs.platform }} - - release: - timeout-minutes: 10 - needs: build - - steps: - - name: Set vars - id: vars - run: | - echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Create Docker Hub manifest - run: | - docker manifest create $DOCKER_REPO:latest \ - $DOCKER_REPO:${{ steps.vars.outputs.version }}-linux-amd64 \ - $DOCKER_REPO:${{ steps.vars.outputs.version }}-linux-arm64 \ - $DOCKER_REPO:${{ steps.vars.outputs.version }}-linux-arm-v6 \ - $DOCKER_REPO:${{ steps.vars.outputs.version }}-linux-arm-v7 - - - name: Push manifests - run: | - docker manifest push $DOCKER_REPO:latest