5050# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
5151OPERATOR_SDK_VERSION ?= v1.39.2
5252
53+ # Container tool to use for building and pushing images
54+ CONTAINER_TOOL ?= docker
55+
5356# Image URL to use all building/pushing image targets
5457IMG ?= controller:latest
5558
@@ -81,11 +84,11 @@ run: helm-operator ## Run against the configured Kubernetes cluster in ~/.kube/c
8184
8285.PHONY : docker-build
8386docker-build : # # Build docker image with the manager.
84- docker build -t ${IMG} .
87+ $( CONTAINER_TOOL ) build -t ${IMG} .
8588
8689.PHONY : docker-push
8790docker-push : # # Push docker image with the manager.
88- docker push ${IMG}
91+ $( CONTAINER_TOOL ) push ${IMG}
8992
9093# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
9194# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
@@ -96,10 +99,10 @@ docker-push: ## Push docker image with the manager.
9699PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
97100.PHONY : docker-buildx
98101docker-buildx : # # Build and push docker image for the manager for cross-platform support
99- - docker buildx create --name project-v3-builder
100- docker buildx use project-v3-builder
101- - docker buildx build --push --platform=$(PLATFORMS ) --tag ${IMG} -f Dockerfile .
102- - docker buildx rm project-v3-builder
102+ - $( CONTAINER_TOOL ) buildx create --name project-v3-builder
103+ $( CONTAINER_TOOL ) buildx use project-v3-builder
104+ - $( CONTAINER_TOOL ) buildx build --push --platform=$(PLATFORMS ) --tag ${IMG} -f Dockerfile .
105+ - $( CONTAINER_TOOL ) buildx rm project-v3-builder
103106
104107# #@ Deployment
105108
@@ -171,8 +174,6 @@ OPERATOR_SDK = $(shell which operator-sdk)
171174endif
172175endif
173176
174- # Container tool to use for building images
175- CONTAINER_TOOL ?= docker
176177
177178.PHONY : bundle
178179bundle : kustomize operator-sdk # # Generate bundle manifests and metadata, then validate generated files.
0 commit comments