From d4fc7c6cbf53a7962f047d036458a723b3882cb0 Mon Sep 17 00:00:00 2001 From: Tsuzu <8574909+tsuzu@users.noreply.github.com> Date: Sat, 18 Feb 2023 03:52:22 +0900 Subject: [PATCH] Build faster --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e054f83..d7cef50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ # Build the manager binary -FROM golang:1.18 as builder +FROM --platform=$BUILDPLATFORM golang:1.18 as builder +ARG TARGETARCH WORKDIR /workspace # Copy the Go Modules manifests @@ -18,7 +19,7 @@ COPY installer/ installer/ COPY common/ common/ # Build -RUN CGO_ENABLED=0 go build -a -o manager main.go +RUN CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH go build -a -o manager main.go # Use distroless as minimal base image to package the manager binary # Refer to https://github.com/GoogleContainerTools/distroless for more details