.PHONY: imageLibvirtd test

REGISTRY_IP=docker.registry
DOCKER_BUILDKIT=1

## build

shell_build_image = docker build --platform=linux/amd64 -t $(REGISTRY_IP):5000/$(1) .; \
        docker push $(REGISTRY_IP):5000/$(1);

imageLibvirtd:
	$(call shell_build_image,libvirtd)

test:
	docker-compose up -d

clean:
	docker-compose down

download = test ! -f "./images/$(shell basename $1)" && \
	wget "$1" -O "./images/$(shell basename $1)" || \
	echo "image $1 exist into /images/$(shell basename $1)"

download_debian:
	@$(call download,https://cdimage.debian.org/cdimage/openstack/current-10/debian-10-openstack-amd64.qcow2)

download_centos:
	@$(call download,https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2)

## management

status:
	@curl -s $(REGISTRY_IP):5000/v2/_catalog | jq