File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# Build the manager binary
2- FROM golang:1.21 AS builder
2+ FROM --platform=$TARGETPLATFORM golang:1.21 AS builder
33ARG TARGETOS
44ARG TARGETARCH
55
@@ -25,7 +25,7 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o ma
2525
2626# Use distroless as minimal base image to package the manager binary
2727# Refer to https://github.com/GoogleContainerTools/distroless for more details
28- FROM gcr.io/distroless/static:nonroot AS production
28+ FROM --platform=$TARGETPLATFORM gcr.io/distroless/static:nonroot AS production
2929WORKDIR /
3030COPY --from=builder /workspace/manager .
3131USER 65532:65532
Original file line number Diff line number Diff line change 22# Image URL to use all building/pushing image targets
33IMG ?= quay.io/spectrocloud-labs/validator-plugin-aws:latest
44
5+ GOARCH ?= $(shell go env GOARCH)
6+
57# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
68ifeq (,$(shell go env GOBIN) )
79GOBIN =$(shell go env GOPATH) /bin
@@ -77,7 +79,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
7779# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
7880.PHONY : docker-build
7981docker-build : test # # Build docker image with the manager.
80- $(CONTAINER_TOOL ) build -t ${IMG} .
82+ $(CONTAINER_TOOL ) build -t ${IMG} . --platform linux/ $( GOARCH )
8183
8284.PHONY : docker-push
8385docker-push : # # Push docker image with the manager.
You can’t perform that action at this time.
0 commit comments