diff --git a/Makefile b/Makefile index e4e2cd4f6..171419195 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ +IMAGE ?= localhost/postgres-operator:latest PGMONITOR_DIR ?= hack/tools/pgmonitor PGMONITOR_VERSION ?= v5.2.1 QUERIES_CONFIG_DIR ?= hack/tools/queries @@ -45,7 +46,7 @@ notes: ## List known issues and future considerations .PHONY: clean clean: ## Clean resources clean: clean-deprecated - rm -f bin/postgres-operator + rm -f bin/postgres-operator image.tar rm -rf licenses/*/ [ ! -d testing/kuttl/e2e-generated ] || rm -r testing/kuttl/e2e-generated [ ! -d hack/tools/envtest ] || { chmod -R u+w hack/tools/envtest && rm -r hack/tools/envtest; } @@ -134,7 +135,7 @@ deploy-dev: createnamespaces .PHONY: build build: ## Build a postgres-operator image build: get-pgmonitor - $(BUILDAH) build --tag localhost/postgres-operator \ + $(BUILDAH) build --tag '$(IMAGE)' \ --label org.opencontainers.image.authors='Crunchy Data' \ --label org.opencontainers.image.description='Crunchy PostgreSQL Operator' \ --label org.opencontainers.image.revision='$(shell git rev-parse HEAD)' \ @@ -142,6 +143,17 @@ build: get-pgmonitor --label org.opencontainers.image.title='Crunchy PostgreSQL Operator' \ . +build-k3d: image.tar ; $(or $(K3D),k3d) image import $< +build-kind: image.tar ; $(or $(KIND),kind) load image-archive $< +build-minikube: image.tar ; $(or $(MINIKUBE),minikube) image load $< + +image.tar: build + set -x && \ + case '$(BUILDAH)' in \ + *docker*) $(BUILDAH) image save '--output=$@' '$(IMAGE)' ;; \ + *) $(BUILDAH) push '$(IMAGE)' 'oci-archive:$@:$(IMAGE)' ;; \ + esac + ##@ Test .PHONY: check