@@ -266,9 +266,8 @@ build: manifests generate fmt vet ## Build manager binary with version metadata
266266run : manifests generate fmt vet # # Run a controller from your host.
267267 go run ./cmd/multigres-operator/main.go
268268
269- # If you wish to build the manager image targeting other platforms you can use the --platform flag.
270- # (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
271- # More info: https://docs.docker.com/develop/develop-images/build_enhancements/
269+ # Cross-platform builds are handled natively via --platform=$BUILDPLATFORM in the Dockerfile.
270+ # Use docker-buildx target or pass --platform to docker build for multi-arch images.
272271.PHONY : container
273272container : # # Build container image
274273 $(CONTAINER_TOOL ) build -t ${IMG} .
@@ -281,22 +280,14 @@ minikube-load:
281280container-push : # # Push container image
282281 $(CONTAINER_TOOL ) push ${IMG}
283282
284- # PLATFORMS defines the target platforms for the manager image be built to provide support to multiple
285- # architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
286- # - be able to use docker buildx. More info: https://docs.docker.com/build/buildx/
287- # - have enabled BuildKit. More info: https://docs.docker.com/develop/develop-images/build_enhancements/
288- # - be able to push the image to your registry (i.e. if you do not set a valid value via IMG=<myregistry/image:<tag>> then the export will fail)
289- # To adequately provide solutions that are compatible with multiple platforms, you should consider using this option.
290- PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
283+ # PLATFORMS defines the target platforms for the manager image.
284+ PLATFORMS ?= linux/arm64,linux/amd64
291285.PHONY : docker-buildx
292- docker-buildx : # # Build and push docker image for the manager for cross-platform support
293- # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
294- sed -e ' 1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
286+ docker-buildx : # # Build and push docker image for cross-platform support
295287 - $(CONTAINER_TOOL ) buildx create --name multigres-operator-builder
296288 $(CONTAINER_TOOL ) buildx use multigres-operator-builder
297- - $(CONTAINER_TOOL ) buildx build --push --platform=$(PLATFORMS ) --tag ${IMG} -f Dockerfile.cross .
289+ - $(CONTAINER_TOOL ) buildx build --push --platform=$(PLATFORMS ) --tag ${IMG} .
298290 - $(CONTAINER_TOOL ) buildx rm multigres-operator-builder
299- rm Dockerfile.cross
300291
301292.PHONY : build-installer
302293build-installer : manifests generate kustomize # # Generate a consolidated YAML with CRDs and deployment.
0 commit comments