From 460c9c9f13632c71940b8ee6c8c2cab9db3a61f2 Mon Sep 17 00:00:00 2001 From: Jonathan Gonzalez V Date: Fri, 15 Jul 2022 16:40:02 -0400 Subject: [PATCH] feat: add multiarch support Modify .goreleaser.yml file to build two images one for amd64 and another for arm64 and then create the proper manifest to publish with the proper images. Closes #215 Signed-off-by: Jonathan Gonzalez V --- .github/workflows/tag.yml | 10 ++++++++++ .goreleaser.yml | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 9f7c09a3..f878d489 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -18,6 +18,16 @@ jobs: with: go-version: 1.17 + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + image: tonistiigi/binfmt:qemu-v6.2.0 + platforms: "linux/amd64, linux/arm64" + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + - name: Login docker.io run: docker login -u celfring -p ${{ secrets.DOCKER_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index 45227c1d..2f9a08b9 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -50,10 +50,39 @@ changelog: dockers: - dockerfile: build/Dockerfile + use: buildx + goos: linux + goarch: amd64 + build_flag_templates: + - "--platform=linux/amd64" image_templates: - - "getwoke/woke:latest" - - "getwoke/woke:{{ .Major }}.{{ .Minor }}" - - "getwoke/woke:{{ .RawVersion }}" + - "getwoke/woke:latest-amd64" + - "getwoke/woke:{{ .Major }}.{{ .Minor }}-amd64" + - "getwoke/woke:{{ .RawVersion }}-amd64" + - dockerfile: build/Dockerfile + use: buildx + goos: linux + goarch: arm64 + build_flag_templates: + - "--platform=linux/arm64" + image_templates: + - "getwoke/woke:latest-arm64" + - "getwoke/woke:{{ .Major }}.{{ .Minor }}-arm64" + - "getwoke/woke:{{ .RawVersion }}-arm64" + +docker_manifests: + - name_template: getwoke/woke:latest + image_templates: + - "getwoke/woke:latest-amd64" + - "getwoke/woke:latest-arm64" + - name_template: getwoke/woke:{{ .Major }}.{{ .Minor }} + image_templates: + - "getwoke/woke:{{ .Major }}.{{ .Minor }}-amd64" + - "getwoke/woke:{{ .Major }}.{{ .Minor }}-arm64" + - name_template: getwoke/woke:{{ .RawVersion }} + image_templates: + - "getwoke/woke:{{ .RawVersion }}-amd64" + - "getwoke/woke:{{ .RawVersion }}-arm64" brews: - tap: