From 687b79b0a46c9bfca6ea24932f6a1e68a86ef9b5 Mon Sep 17 00:00:00 2001 From: n-029894 Date: Tue, 14 Nov 2023 11:25:09 -0500 Subject: [PATCH] Add support for arm platforms --- .github/workflows/ci.yml | 18 ++++++++++++++---- .github/workflows/deploy-main.yml | 16 ++++++++++++---- .github/workflows/deploy-release.yml | 18 +++++++++++++----- 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49ff14b..676bc87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,13 @@ name: CI -on: +on: workflow_dispatch: push: branches-ignore: - main pull_request: types: [opened] - + jobs: build: name: Build @@ -21,8 +21,18 @@ jobs: with: go-version: '^1.12' + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build run: make build - - name: Container - Build - run: docker build . + - name: Container - Build + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: false diff --git a/.github/workflows/deploy-main.yml b/.github/workflows/deploy-main.yml index 17c11c2..c44d45a 100644 --- a/.github/workflows/deploy-main.yml +++ b/.github/workflows/deploy-main.yml @@ -30,8 +30,16 @@ jobs: username: ${{ secrets.DOCKERHUB_USER }} password: ${{ secrets.DOCKERHUB_PASS }} - - name: Container - Build - run: docker build -t ${{ env.REGISTRY }}:latest . + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - - name: Container - Push - run: docker push ${{ env.REGISTRY }}:latest + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Container - Build and Push + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ env.REGISTRY }}:latest diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml index 8b3da39..47d296f 100644 --- a/.github/workflows/deploy-release.yml +++ b/.github/workflows/deploy-release.yml @@ -4,7 +4,7 @@ on: release: types: - released - + env: REGISTRY: containersol/locust_exporter @@ -31,8 +31,16 @@ jobs: username: ${{ secrets.DOCKERHUB_USER }} password: ${{ secrets.DOCKERHUB_PASS }} - - name: Container - Build - run: docker build -t ${{ env.REGISTRY }}:$(echo $GITHUB_REF | sed -e "s/refs\/tags\///g") . + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Container - Push - run: docker push ${{ env.REGISTRY }}:$(echo $GITHUB_REF | sed -e "s/refs\/tags\///g") + - name: Container - Build and Push + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ env.REGISTRY }}:$(echo $GITHUB_REF | sed -e "s/refs\/tags\///g")