Enable podman-compose
By default Makefile used docker. Added command to execute podman-compose if it's present. Depends-On: https://review.opendev.org/c/opendev/elastic-recheck/+/841306 Change-Id: I8379f313b96c4884766c5af4179d5e4721e8c2b2
This commit is contained in:
parent
c6c95395ae
commit
1fdc167bec
20
Makefile
20
Makefile
|
@ -4,6 +4,8 @@ PYTHON ?= $(shell command -v python3 python|head -n1)
|
|||
# Keep docker before podman due to:
|
||||
# https://github.com/containers/podman/issues/7602
|
||||
ENGINE ?= $(shell command -v docker podman|head -n1)
|
||||
COMPOSE ?= $(shell command -v docker-compose podman-compose|head -n1)
|
||||
|
||||
# localhost/ prefix must be present in order to assure docker/podman compatibility:
|
||||
# https://github.com/containers/buildah/issues/1034
|
||||
IMAGE_TAG=localhost/elastic-recheck
|
||||
|
@ -42,11 +44,11 @@ ifndef GERRIT_USER
|
|||
endif
|
||||
|
||||
.PHONY: build
|
||||
build: data/id_rsa check-env ## Build image using docker
|
||||
build: data/id_rsa check-env ## Build image using $(ENGINE)
|
||||
@echo "Checking that current user can connect to gerit using ssh..."""
|
||||
@python3 ./tools/ssh-check.py
|
||||
$(ENGINE) build -t $(IMAGE_TAG) .
|
||||
@echo "Image size: $$(docker image inspect --format='scale=0; {{.Size}}/1024/1024' $(IMAGE_TAG) | bc)MB"
|
||||
@echo "Image size: $$($(ENGINE) image inspect --format='scale=0; {{.Size}}/1024/1024' $(IMAGE_TAG) | bc)MB"
|
||||
@echo "Validate that built container can also connect to gerrit..."""
|
||||
$(ENGINE) run --env GERRIT_USER -it $(IMAGE_TAG) python3 /root/ssh-check.py
|
||||
|
||||
|
@ -56,20 +58,20 @@ up: data/id_rsa check-env ## Run containers
|
|||
@# Validate the builder image can connect to server
|
||||
@# $(ENGINE) run --env GERRIT_USER -it $(IMAGE_TAG) python3 /root/ssh-check.py
|
||||
@# --abort-on-container-exit
|
||||
docker-compose up --force-recreate --remove-orphans --abort-on-container-exit <<<y
|
||||
@# docker container stop elastic-recheck
|
||||
@# bash -c "docker rm elastic-recheck || true"
|
||||
@# docker run --env ES_URL --env LS_URL --env DB_URI --env GERRIT_HOST --env GERRIT_USER --env IRC_NICK --env IRC_PASS -it --name elastic-recheck elastic-recheck:latest
|
||||
$(COMPOSE) up --force-recreate --remove-orphans --abort-on-container-exit <<<y
|
||||
@# $(ENGINE) container stop elastic-recheck
|
||||
@# bash -c "$(ENGINE) rm elastic-recheck || true"
|
||||
@# $(ENGINE) run --env ES_URL --env LS_URL --env DB_URI --env GERRIT_HOST --env GERRIT_USER --env IRC_NICK --env IRC_PASS -it --name elastic-recheck elastic-recheck:latest
|
||||
|
||||
.PHONY: down
|
||||
down: ## Destroy containers
|
||||
docker-compose down --remove-orphans --rmi local
|
||||
$(COMPOSE) down --remove-orphans --rmi local
|
||||
|
||||
.PHONY: into
|
||||
into: ## Starts bash inside docker image
|
||||
into: ## Starts bash inside $(ENGINE) image
|
||||
$(ENGINE) run --mount 'type=volume,src=er-volume,dst=/data,volume-driver=local' -it $(IMAGE_TAG) /bin/sh
|
||||
# $(ENGINE) exec -it er-cron /bin/sh
|
||||
@# docker-compose run elastic-recheck bash
|
||||
@# $(COMPOSE) run elastic-recheck bash
|
||||
|
||||
.PHONY: dive
|
||||
dive: ## Use `dive` tool to investigate container size
|
||||
|
|
Loading…
Reference in New Issue