tools/guestfs: Use build --iidfile

Modelled after tools/alpine's build.

Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
Ian Campbell 2017-07-26 13:41:37 +01:00
parent d823d7fab7
commit b472f79dbf

View File

@ -5,25 +5,25 @@ IMAGE=guestfs
default: push
hash: Dockerfile
iid: Dockerfile
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
docker run --rm $(IMAGE):build sh -c 'apt list --installed 2>/dev/null | sha1sum' | sed 's/ .*//' > hash
tar cf - $^ | docker build --no-cache --iidfile iid -
push: hash
hash: Makefile iid
docker run --rm $(shell cat iid) sh -c 'apt list --installed 2>/dev/null | sha1sum' | sed 's/ .*//' > hash
push: hash iid
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
(docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash) && \
(docker tag $(shell cat iid) linuxkit/$(IMAGE):$(shell cat hash) && \
docker push linuxkit/$(IMAGE):$(shell cat hash))
docker rmi $(IMAGE):build
rm -f hash
rm -f iid
tag: hash
tag: hash iid
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash)
docker rmi $(IMAGE):build
rm -f hash
docker tag $(shell cat iid) linuxkit/$(IMAGE):$(shell cat hash)
rm -f iid
clean:
rm -f hash
rm -f hash iid
.DELETE_ON_ERROR: