Skip to content

Commit

Permalink
feat: multi arch build
Browse files Browse the repository at this point in the history
  • Loading branch information
jirevwe committed Aug 21, 2024
1 parent f246c1c commit 9c3c267
Showing 1 changed file with 51 additions and 15 deletions.
66 changes: 51 additions & 15 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ jobs:
web/ui/dashboard/dist
!web/ui/dashboard/dist/**/*.md
build-and-push:
build-and-push-arch:
runs-on: ubuntu-latest
needs: [build_ui]

strategy:
matrix:
include:
Expand All @@ -47,13 +46,9 @@ jobs:
- arch: arm64
platform: linux/arm64
dockerfile: release.Dockerfile
- arch: slim
platform: linux/amd64
dockerfile: slim.Dockerfile

steps:
- uses: actions/checkout@v4

- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -90,27 +85,68 @@ jobs:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_TOKEN }}

- name: Build and push default image
- name: Build and push arch specific images
uses: docker/build-push-action@v2
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platform }}
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}-${{ matrix.arch }}
build-args: |
ARCH=${{ matrix.arch }}
- name: Build and push arch specific images
build-and-push-default:
runs-on: ubuntu-latest
needs: [build_ui]
steps:
- uses: actions/checkout@v4

- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: dist-without-markdown
path: api/ui/build
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Check out code
uses: actions/checkout@v4

- name: Get and verify dependencies
run: go mod tidy && go mod download && go mod verify

- name: Go vet
run: go vet ./...

- name: Build app to make sure there are zero issues
run: go build -o convoy ./cmd

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_TOKEN }}

- name: Build and push default image
uses: docker/build-push-action@v2
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platform }}
file: release.Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}-${{ matrix.arch }}
build-args: |
ARCH=${{ matrix.arch }}
${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
${{ env.IMAGE_NAME }}:latest

0 comments on commit 9c3c267

Please sign in to comment.