From 23c0d1d9f902e838af144ae5c7c92c988573c0d7 Mon Sep 17 00:00:00 2001 From: Camila Macedo <7708031+camilamacedo86@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:50:20 +0000 Subject: [PATCH] feat: add support for Podman as a container runtime Since docker requires a license in some scenarios, we might have contributors who prefer to use Podman. This commit introduces the changes necessary to support both. --- Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3060bb52..cf496a24 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,14 @@ ifeq ($(shell [[ $$HOME == "" || $$HOME == "/" ]] && [[ $$XDG_DATA_HOME == "" ]] SETUP_ENVTEST_BIN_DIR_OVERRIDE += --bin-dir /tmp/envtest-binaries endif +ifneq (, $(shell command -v docker 2>/dev/null)) +CONTAINER_RUNTIME := docker +else ifneq (, $(shell command -v podman 2>/dev/null)) +CONTAINER_RUNTIME := podman +else +$(warning Could not find docker or podman in path! This may result in targets requiring a container runtime failing!) +endif + # For standard development and release flows, we use the config/overlays/cert-manager overlay. KUSTOMIZE_OVERLAY := config/overlays/cert-manager @@ -200,7 +208,7 @@ run: generate kind-cluster install ## Create a kind cluster and install a local .PHONY: build-container build-container: build-linux ## Build docker image for catalogd. - docker build -f Dockerfile -t $(IMAGE) bin/linux + $(CONTAINER_RUNTIME) build -f Dockerfile -t $(IMAGE) ./bin/linux ##@ Deploy @@ -215,7 +223,7 @@ kind-cluster-cleanup: $(KIND) ## Delete the kind cluster .PHONY: kind-load kind-load: check-cluster $(KIND) ## Load the built images onto the local cluster - docker save $(IMAGE) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME) + $(CONTAINER_RUNTIME) save $(IMAGE) | $(KIND) load image-archive /dev/stdin --name $(KIND_CLUSTER_NAME) .PHONY: install install: check-cluster build-container kind-load deploy wait ## Install local catalogd to an existing cluster