From 8e324ac233c13f216f02363dc4a156268a78eaa3 Mon Sep 17 00:00:00 2001 From: Alessandro Gregori Date: Thu, 7 Mar 2024 15:31:06 +0100 Subject: [PATCH 1/4] chore(docker): add arch inside dockerfile go can compile in arm very fast, it just need to know that. --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cdefe8c..56deee9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ # Build the application FROM golang:1.20 AS build-stage +ARG TARGETPLATFORM WORKDIR /app @@ -10,7 +11,7 @@ RUN go mod download COPY *.go ./ -ENV CGO_ENABLED=0 GOOS=linux +ENV CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETPLATFORM GO111MODULE=on RUN go build -o /bin/sentry-kubernetes From e4e4aac31921606c17c50a4f68145f2284f9a1f1 Mon Sep 17 00:00:00 2001 From: Alessandro Gregori Date: Thu, 7 Mar 2024 15:31:25 +0100 Subject: [PATCH 2/4] chore(pipeline): enable arm build --- .github/workflows/build-push.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push.yaml b/.github/workflows/build-push.yaml index d676709..a894c99 100644 --- a/.github/workflows/build-push.yaml +++ b/.github/workflows/build-push.yaml @@ -23,7 +23,7 @@ jobs: matrix: arch: - linux/amd64 - # - linux/arm64 + - linux/arm64 permissions: packages: write contents: read From fb450951cad1a421f470e5ac7868054813242f79 Mon Sep 17 00:00:00 2001 From: Greg <58505377+nohant@users.noreply.github.com> Date: Tue, 12 Mar 2024 10:09:43 +0100 Subject: [PATCH 3/4] Update Dockerfile Co-authored-by: Anton Ovchinnikov --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 56deee9..0abdc0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # Build the application FROM golang:1.20 AS build-stage -ARG TARGETPLATFORM +ARG TARGETARCH WORKDIR /app From 880285119d88a0b0dbeda1ae908b43f3fb252d4b Mon Sep 17 00:00:00 2001 From: Anton Ovchinnikov Date: Tue, 12 Mar 2024 14:41:30 +0100 Subject: [PATCH 4/4] Remove ARG, use TARGETPLATFORM --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0abdc0f..8d499ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,6 @@ # Build the application FROM golang:1.20 AS build-stage -ARG TARGETARCH WORKDIR /app @@ -11,7 +10,7 @@ RUN go mod download COPY *.go ./ -ENV CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETPLATFORM GO111MODULE=on +ENV CGO_ENABLED=0 GOOS=${TARGETPLATFORM} GOARCH=${TARGETARCH} GO111MODULE=on RUN go build -o /bin/sentry-kubernetes