tests: Use git tree hash for virtsock package

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@docker.com>
This commit is contained in:
Rolf Neugebauer 2017-05-05 16:59:12 +01:00
parent 725853f11d
commit 9cb3c53b8f

View File

@ -1,26 +1,14 @@
.PHONY: tag push .PHONY: tag push
IMAGE=test-virtsock
default: push default: push
IMAGE=test-virtsock
DEPS=Dockerfile Makefile DEPS=Dockerfile Makefile
SHASUM=alpine:3.5
hash: $(DEPS)
find $^ -type f | xargs cat | DOCKER_CONTENT_TRUST=1 docker run --rm -i $(SHASUM) sha1sum | sed 's/ .*//' > $@
tag: hash HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}')
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
(docker build --no-cache -t $(IMAGE):build . && \ tag: $(DEPS)
docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash)) docker build --no-cache -t linuxkit/$(IMAGE):$(HASH) .
docker rmi $(IMAGE):build || true
push: tag push: tag
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \ docker pull linuxkit/$(IMAGE):$(HASH) || \
docker push linuxkit/$(IMAGE):$(shell cat hash) docker push linuxkit/$(IMAGE):$(HASH)
rm -f hash
clean:
rm -rf hash
docker rmi $(IMAGE):build || true
.DELETE_ON_ERROR: