From 614384f5ce96079b60aabbcf190ab733f01a84d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Thu, 18 Dec 2025 14:34:50 +0100 Subject: [PATCH] feat: add support for building ARM64 container images --- .goreleaser.yml | 41 +++++++++++++++++++++++++++++++++++++++++ Dockerfile | 5 ++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 1af14ee0d3..1b9c314477 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -61,6 +61,47 @@ dockers: - .git build_flag_templates: - "--build-arg=VERSION={{ .Version }}" + use: buildx + goarch: amd64 + dockerfile: Dockerfile + - image_templates: + - "scaleway/cli:latest-arm64" + - "scaleway/cli:{{ .Tag }}-arm64" + - "scaleway/cli:{{ .Major }}-arm64" + - "scaleway/cli:{{ .Major }}.{{ .Minor }}-arm64" + extra_files: + - go.mod + - go.sum + - scripts + - cmd + - core + - commands + - internal + - .git + build_flag_templates: + - "--build-arg=VERSION={{ .Version }}" + - "--platform=linux/arm64" + use: buildx + goarch: arm64 + dockerfile: Dockerfile + +docker_manifests: + - name_template: "scaleway/cli:latest" + image_templates: + - "scaleway/cli:latest" + - "scaleway/cli:latest-arm64" + - name_template: "scaleway/cli:{{ .Tag }}" + image_templates: + - "scaleway/cli:{{ .Tag }}" + - "scaleway/cli:{{ .Tag }}-arm64" + - name_template: "scaleway/cli:{{ .Major }}" + image_templates: + - "scaleway/cli:{{ .Major }}" + - "scaleway/cli:{{ .Major }}-arm64" + - name_template: "scaleway/cli:{{ .Major }}.{{ .Minor }}" + image_templates: + - "scaleway/cli:{{ .Major }}.{{ .Minor }}" + - "scaleway/cli:{{ .Major }}.{{ .Minor }}-arm64" release: github: diff --git a/Dockerfile b/Dockerfile index 62a7db5a10..2ce54757c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ -FROM golang:1.25-alpine3.21 AS builder +FROM --platform=$BUILDPLATFORM golang:1.25-alpine3.21 AS builder ENV BUILD_IN_DOCKER=true +ARG TARGETPLATFORM +ARG TARGETOS +ARG TARGETARCH ARG VERSION # ca-certificates is needed to add the certificates on the next image