Files
linuxkit/tools/alpine/Makefile
Ian Campbell 28905c57cc alpine: Record image has in versions file
Otherwise the only record is if the pusher happens to remember to put it in the
commit message (tollerable) or the github PR (not great).

Also add the same show-tag target as `pkg/package.mk` supports, although with a
very different implementation.

The actual hash is unchanged from the previous commit.

Signed-off-by: Ian Campbell <ijc@docker.com>
2017-07-14 12:41:11 +01:00

34 lines
1.1 KiB
Makefile

.PHONY: tag push
ORG?=linuxkit
IMAGE=alpine
BASE=alpine:3.6
default: push
show-tag:
@sed -n -e '1s/# \(.*\/.*:[0-9a-f]\{40\}\)/\1/p;q' versions
hash: Dockerfile Makefile packages
DOCKER_CONTENT_TRUST=1 docker pull $(BASE)
docker build --no-cache -t $(IMAGE):build .
docker run --rm $(IMAGE):build sh -c 'echo Dockerfile /lib/apk/db/installed $$(find /mirror -name '*.apk' -type f) $$(find /go/bin -type f) | xargs cat | sha1sum' | sed 's/ .*//' > $@
push: hash
DOCKER_CONTENT_TRUST=1 docker pull $(ORG)/$(IMAGE):$(shell cat hash) || \
(docker tag $(IMAGE):build $(ORG)/$(IMAGE):$(shell cat hash) && \
DOCKER_CONTENT_TRUST=1 docker push $(ORG)/$(IMAGE):$(shell cat hash))
echo "# $(ORG)/$(IMAGE):$(shell cat hash)" > versions
docker run --rm $(IMAGE):build find /mirror -name '*.apk' -exec basename '{}' .apk \; | sort | (echo '# automatically generated list of installed packages'; cat -) >> versions
docker rmi $(IMAGE):build
rm -f hash
tag: hash
docker pull $(ORG)/$(IMAGE):$(shell cat hash) || \
docker tag $(IMAGE):build $(ORG)/$(IMAGE):$(shell cat hash)
docker rmi $(IMAGE):build
rm -f hash
clean:
rm -f hash