@@ -134,13 +134,10 @@ docker-push: ## Push docker image with the manager.
134134# To properly provided solutions that supports more than one platform you should use this option.
135135PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
136136.PHONY : docker-buildx
137- docker-buildx : test # # Build and push docker image for the manager for cross-platform support
137+ docker-buildx : test create-buildx # # Build and push docker image for the manager for cross-platform support
138138 # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
139139 sed -e ' 1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
140- - docker buildx create --name project-v3-builder
141- docker buildx use project-v3-builder
142- - docker buildx build --push --platform=$(PLATFORMS ) --tag ${IMG} -f Dockerfile.cross
143- - docker buildx rm project-v3-builder
140+ - docker buildx build --push --platform=$(PLATFORMS ) --tag ${IMG} -f Dockerfile.cross .
144141 rm Dockerfile.cross
145142
146143# #@ Deployment
@@ -213,6 +210,22 @@ bundle-build: ## Build the bundle image.
213210bundle-push : # # Push the bundle image.
214211 $(MAKE ) docker-push IMG=$(BUNDLE_IMG )
215212
213+ .PHONY : bundle-buildx
214+ bundle-buildx : test create-buildx # # Build and push docker image for the manager for cross-platform support
215+ # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
216+ sed -e ' 1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' bundle.Dockerfile > bundle.Dockerfile.cross
217+ - docker buildx build --push --platform=$(PLATFORMS ) --tag ${BUNDLE_IMG} -f bundle.Dockerfile.cross .
218+ rm bundle.Dockerfile.cross
219+
220+ .PHONY : create-buildx
221+ create-buildx : # # Create a buildx builder
222+ - docker buildx create --name project-v3-builder
223+ docker buildx use project-v3-builder
224+
225+ .PHONY : cleanup-buildx
226+ cleanup-buildx : # # Cleanup a buildx builder
227+ - docker buildx rm project-v3-builder
228+
216229.PHONY : opm
217230OPM = ./bin/opm
218231opm : # # Download opm locally if necessary.
0 commit comments