|
5 | 5 | # - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
|
6 | 6 | VERSION ?= ""
|
7 | 7 |
|
| 8 | + |
| 9 | +# Try to detect Docker or Podman |
| 10 | +CONTAINER_RUNTIME := $(shell command -v docker 2> /dev/null || command -v podman 2> /dev/null) |
| 11 | + |
| 12 | +# If neither Docker nor Podman is found, print an error message and exit |
| 13 | +ifeq ($(CONTAINER_RUNTIME),) |
| 14 | +$(warning "No container runtime (Docker or Podman) found in PATH. Please install one of them.") |
| 15 | +endif |
8 | 16 | # CHANNELS define the bundle channels used in the bundle.
|
9 | 17 | # Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable")
|
10 | 18 | # To re-generate a bundle for other specific channels without changing the standard setup, you can:
|
@@ -206,12 +214,12 @@ run: manifests generate fmt vet ## Run a controller from your host.
|
206 | 214 | CLUSTER_SCOPED_ARGO_ROLLOUTS_NAMESPACES=argo-rollouts,test-rom-ns-1,rom-ns-1,openshift-gitops ARGOCD_CLUSTER_CONFIG_NAMESPACES=openshift-gitops REDIS_CONFIG_PATH="build/redis" go run ./cmd/main.go
|
207 | 215 |
|
208 | 216 | .PHONY: docker-build
|
209 |
| -docker-build: test ## Build docker image with the manager. |
210 |
| - docker build -t ${IMG} . |
| 217 | +docker-build: test ## Build $(CONTAINER_RUNTIME) image with the manager. |
| 218 | + $(CONTAINER_RUNTIME) build -t ${IMG} . |
211 | 219 |
|
212 | 220 | .PHONY: docker-push
|
213 |
| -docker-push: ## Push docker image with the manager. |
214 |
| - docker push ${IMG} |
| 221 | +docker-push: ## Push $(CONTAINER_RUNTIME) image with the manager. |
| 222 | + $(CONTAINER_RUNTIME) push ${IMG} |
215 | 223 |
|
216 | 224 | ##@ Build Dependencies
|
217 | 225 |
|
@@ -305,11 +313,11 @@ bundle: operator-sdk manifests kustomize ## Generate bundle manifests and metada
|
305 | 313 |
|
306 | 314 | .PHONY: bundle-build
|
307 | 315 | bundle-build: ## Build the bundle image.
|
308 |
| - docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) . |
| 316 | + $(CONTAINER_RUNTIME) build -f bundle.Dockerfile -t $(BUNDLE_IMG) . |
309 | 317 |
|
310 | 318 | .PHONY: bundle-push
|
311 | 319 | bundle-push: ## Push the bundle image.
|
312 |
| - $(MAKE) docker-push IMG=$(BUNDLE_IMG) |
| 320 | + $(MAKE) $(CONTAINER_RUNTIME)-push IMG=$(BUNDLE_IMG) |
313 | 321 |
|
314 | 322 | .PHONY: opm
|
315 | 323 | OPM = ./bin/opm
|
@@ -346,12 +354,12 @@ endif
|
346 | 354 | # https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
|
347 | 355 | .PHONY: catalog-build
|
348 | 356 | catalog-build: opm ## Build a catalog image.
|
349 |
| - $(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) |
| 357 | + $(OPM) index add --container-tool $(CONTAINER_RUNTIME) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) |
350 | 358 |
|
351 | 359 | # Push the catalog image.
|
352 | 360 | .PHONY: catalog-push
|
353 | 361 | catalog-push: ## Push a catalog image.
|
354 |
| - $(MAKE) docker-push IMG=$(CATALOG_IMG) |
| 362 | + $(MAKE) $(CONTAINER_RUNTIME)-push IMG=$(CATALOG_IMG) |
355 | 363 |
|
356 | 364 |
|
357 | 365 | .PHONY: gosec
|
|
0 commit comments