@@ -135,34 +135,6 @@ build: manifests generate fmt vet ## Build controller binary.
135135run : manifests generate fmt vet # # Run a controller from your host.
136136 go run ./cmd/controller/main.go
137137
138- # If you wish to build the manager image targeting other platforms you can use the --platform flag.
139- # (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
140- # More info: https://docs.docker.com/develop/develop-images/build_enhancements/
141- .PHONY : image-build
142- image-build : # # Build docker image with the manager.
143- $(CONTAINER_TOOL ) build -t ${IMG} .
144-
145- .PHONY : image-push
146- image-push : # # Push docker image with the manager.
147- $(CONTAINER_TOOL ) push ${IMG}
148-
149- # PLATFORMS defines the target platforms for the manager image be built to provide support to multiple
150- # architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
151- # - be able to use docker buildx. More info: https://docs.docker.com/build/buildx/
152- # - have enabled BuildKit. More info: https://docs.docker.com/develop/develop-images/build_enhancements/
153- # - 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)
154- # To adequately provide solutions that are compatible with multiple platforms, you should consider using this option.
155- PLATFORMS ?= linux/arm64,linux/amd64
156- .PHONY : docker-buildx
157- image-buildx : # # Build and push docker image for the manager for cross-platform support
158- # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
159- sed -e ' 1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
160- - $(CONTAINER_TOOL ) buildx create --name project-v3-builder
161- $(CONTAINER_TOOL ) buildx use project-v3-builder
162- - $(CONTAINER_TOOL ) buildx build --push --platform=$(PLATFORMS ) --tag ${IMG} -f Dockerfile.cross .
163- - $(CONTAINER_TOOL ) buildx rm project-v3-builder
164- rm Dockerfile.cross
165-
166138# #@ Build Dependencies
167139
168140# # Location to install dependencies to
0 commit comments