From 97310c07793e421b3eaf5ae4fde750e404df45de Mon Sep 17 00:00:00 2001 From: Bharath Horatti Date: Tue, 17 Sep 2024 21:33:19 +0530 Subject: [PATCH] fix(): Enable multi arch builds Signed-off-by: Bharath Horatti --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index b50250f..63c5562 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ #limitations under the License. ########################################################## -FROM amd64/golang:1.22.5-alpine3.20 AS gobuilder +FROM golang:1.22.5-alpine3.20 AS gobuilder # Install git. @@ -25,6 +25,9 @@ FROM amd64/golang:1.22.5-alpine3.20 AS gobuilder RUN apk update && apk add --no-cache git make build-base +ARG TARGETPLATFORM +ARG TARGETARCH + # Set the Go source path WORKDIR / @@ -35,12 +38,12 @@ COPY . . RUN go mod download &&\ go env -w GOPRIVATE=github.com/kubeslice && \ - CGO_ENABLED=1 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o bin/kubeslice-gateway-edge main.go + CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -a -o bin/kubeslice-gateway-edge main.go # Build reduced image from base alpine -FROM amd64/alpine:3.20.1 +FROM alpine:3.20.1 # tc - is needed for traffic control and shaping on the sidecar. it is part of the iproute2 @@ -60,4 +63,4 @@ EXPOSE 8080 # Or could be CMD -ENTRYPOINT ["./kubeslice-gateway-edge"] \ No newline at end of file +ENTRYPOINT ["./kubeslice-gateway-edge"]