From 8dfb2cae07db3d6c03244ea8b2d450b39c716dbe Mon Sep 17 00:00:00 2001 From: Peiman Jafari <18074432+peimanja@users.noreply.github.com> Date: Mon, 19 Feb 2024 21:17:07 -0800 Subject: [PATCH] ci: Fix multi-platform build (#134) * ci: Fix multi-platform build * update * update --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 08961e0..94cceaf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21 as build +FROM golang:1.21 AS build WORKDIR /go/artifactory_exporter ADD . /go/artifactory_exporter @@ -13,7 +13,10 @@ ARG SOURCE_BRANCH ARG BUILD_DATE ARG BUILD_USER -RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -o /go/bin/artifactory_exporter -ldflags " \ + +ARG TARGETPLATFORM + +RUN CGO_ENABLED=0 GOOS=linux GOARCH=$(echo ${TARGETPLATFORM} | cut -d / -f2) go build -a -o /go/bin/artifactory_exporter -ldflags " \ -X github.com/prometheus/common/version.Version=${VERSION} \ -X github.com/prometheus/common/version.Revision=${SOURCE_COMMIT} \ -X github.com/prometheus/common/version.Branch=${SOURCE_BRANCH} \