From d0943c3b77537175d816e89f9e90cc995c7b2967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nils=20m=C3=A5s=C3=A9n?= Date: Thu, 4 Feb 2021 11:30:56 +0100 Subject: [PATCH] chore(ci): set image platform on image build (#811) Co-authored-by: Simon Aronsson --- .github/workflows/pull-request.yml | 2 +- .github/workflows/release.yml | 6 ++-- dockerfiles/Dockerfile | 2 +- goreleaser.yml | 45 ++++++++++++++++++------------ 4 files changed, 32 insertions(+), 23 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 180b105..099e259 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -69,5 +69,5 @@ jobs: - name: Build uses: goreleaser/goreleaser-action@v2 with: - version: v0.104.1 + version: v0.155.0 args: --snapshot --skip-publish --debug diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a83e1f..e2bdb86 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,10 +70,10 @@ jobs: uses: actions/setup-go@v2 with: go-version: 1.15.x - - name: Run goreleaser + - name: Build uses: goreleaser/goreleaser-action@v2 with: - version: v0.104.1 + version: v0.155.0 args: --debug - name: Enable experimental docker features run: | @@ -176,4 +176,4 @@ jobs: - \ No newline at end of file + diff --git a/dockerfiles/Dockerfile b/dockerfiles/Dockerfile index 7e28eb2..345f5c2 100644 --- a/dockerfiles/Dockerfile +++ b/dockerfiles/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.11 as alpine +FROM --platform=$BUILDPLATFORM alpine:3.11 as alpine RUN apk add --no-cache \ ca-certificates \ diff --git a/goreleaser.yml b/goreleaser.yml index 927cdcd..2bdd067 100644 --- a/goreleaser.yml +++ b/goreleaser.yml @@ -9,23 +9,26 @@ build: - 386 - arm - arm64 -archive: - name_template: "{{.ProjectName}}_{{.Os}}_{{.Arch}}" - format: tar.gz - replacements: - arm: armhf - arm64: arm64v8 - amd64: amd64 - 386: 386 - darwin: macOS - linux: linux - format_overrides: - - goos: windows - format: zip - files: - - LICENSE.md +archives: + - + name_template: "{{.ProjectName}}_{{.Os}}_{{.Arch}}" + format: tar.gz + replacements: + arm: armhf + arm64: arm64v8 + amd64: amd64 + 386: 386 + darwin: macOS + linux: linux + format_overrides: + - goos: windows + format: zip + files: + - LICENSE.md dockers: - + use_buildx: true + build_flag_templates: [ "--platform=linux/amd64" ] goos: linux goarch: amd64 goarm: '' @@ -35,7 +38,9 @@ dockers: - containrrr/watchtower:amd64-latest binaries: - watchtower - - + - + use_buildx: true + build_flag_templates: [ "--platform=linux/386" ] goos: linux goarch: 386 goarm: '' @@ -45,7 +50,9 @@ dockers: - containrrr/watchtower:i386-latest binaries: - watchtower - - + - + use_buildx: true + build_flag_templates: [ "--platform=linux/arm/v6" ] goos: linux goarch: arm goarm: 6 @@ -55,7 +62,9 @@ dockers: - containrrr/watchtower:armhf-latest binaries: - watchtower - - + - + use_buildx: true + build_flag_templates: [ "--platform=linux/arm64/v8" ] goos: linux goarch: arm64 goarm: ''