OUTPUT ?= $(USER)/bip
CTR ?= podman
IMAGE ?= fedora
TAG ?= 29
.PHONY: image
image: .nvr
$(CTR) tag $(OUTPUT) $(OUTPUT):$(shell cat .nvr)
.PHONY: .nvr
.nvr: latest
$(CTR) run \
-it \
--rm \
$(OUTPUT) \
rpm -q bip | tee $@
latest: .digest
$(CTR) build \
--build-arg "IMAGE=$(IMAGE)" \
--build-arg "IMAGE_TAG=$(TAG)" \
--build-arg "DIGEST=$(shell cat .digest)" \
-t $(OUTPUT) \
.
pull:
$(CTR) pull $(IMAGE):$(TAG)
.PHONY: .digest
.digest: pull
$(CTR) images --digests --format "{{.Digest}}" $(IMAGE):$(TAG) | head -1 | tee $@