diff --git a/Makefile b/Makefile index bc02eaa..5ad6e8e 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ IMAGE_NAME := quay.io/app-sre/qontract-server IMAGE_TAG := $(shell git rev-parse --short=7 HEAD) APP_INTERFACE_PATH ?= $(shell pwd)/../../service/app-interface +CONTAINER_ENGINE ?= $(shell which podman >/dev/null 2>&1 && echo podman || echo docker) SCHEMAS_PATH ?= $(shell pwd)/../qontract-schemas SCHEMAS_DIR := $(SCHEMAS_PATH)/schemas GRAPHQL_SCHEMA_DIR := $(SCHEMAS_PATH)/graphql-schemas @@ -24,16 +25,16 @@ endif dev: docker-run-clean bundle docker-run bundle: - @docker pull $(VALIDATOR_IMAGE_NAME):$(VALIDATOR_IMAGE_TAG) + @$(CONTAINER_ENGINE) pull $(VALIDATOR_IMAGE_NAME):$(VALIDATOR_IMAGE_TAG) mkdir -p $(BUNDLE_DIR) - @docker run --rm \ + @$(CONTAINER_ENGINE) run --rm \ -v $(SCHEMAS_DIR):/schemas:z \ -v $(GRAPHQL_SCHEMA_DIR):/graphql:z \ -v $(DATA_DIR):/data:z \ -v $(RESOURCES_DIR):/resources:z \ $(VALIDATOR_IMAGE_NAME):$(VALIDATOR_IMAGE_TAG) \ qontract-bundler /schemas /graphql/schema.yml /data /resources $(GIT_COMMIT) $(GIT_COMMIT_TIMESTAMP) > $(BUNDLE_DIR)/$(BUNDLE_FILENAME) - @docker run --rm \ + @$(CONTAINER_ENGINE) run --rm \ -v $(BUNDLE_DIR):/bundle:z \ $(VALIDATOR_IMAGE_NAME):$(VALIDATOR_IMAGE_TAG) \ qontract-validator --only-errors /bundle/$(BUNDLE_FILENAME) @@ -42,7 +43,7 @@ run: LOAD_METHOD=fs DATAFILES_FILE=$(BUNDLE_DIR)/$(BUNDLE_FILENAME) yarn run server docker-run: - @docker run -it --rm \ + @$(CONTAINER_ENGINE) run -it --rm \ -v $(BUNDLE_DIR):/bundle:z \ -p 4000:4000 \ -e LOAD_METHOD=fs \ @@ -50,12 +51,12 @@ docker-run: $(IMAGE_NAME):$(IMAGE_TAG) docker-run-clean: - @docker ps -aq | xargs docker rm -f || true + @$(CONTAINER_ENGINE) ps -aq | xargs $(CONTAINER_ENGINE) rm -f || true build: - @docker build --pull -t $(IMAGE_NAME):latest . - @docker tag $(IMAGE_NAME):latest $(IMAGE_NAME):$(IMAGE_TAG) + @$(CONTAINER_ENGINE) build --pull -t $(IMAGE_NAME):latest . + @$(CONTAINER_ENGINE) tag $(IMAGE_NAME):latest $(IMAGE_NAME):$(IMAGE_TAG) push: - @docker --config=$(DOCKER_CONF) push $(IMAGE_NAME):latest - @docker --config=$(DOCKER_CONF) push $(IMAGE_NAME):$(IMAGE_TAG) + @$(CONTAINER_ENGINE) --config=$(DOCKER_CONF) push $(IMAGE_NAME):latest + @$(CONTAINER_ENGINE) --config=$(DOCKER_CONF) push $(IMAGE_NAME):$(IMAGE_TAG)