mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-01-14 08:10:10 +00:00
30 lines
798 B
Makefile
30 lines
798 B
Makefile
.PHONY: tag push clean container
|
|
default: push
|
|
|
|
IMAGE=node_exporter
|
|
SHA_IMAGE=alpine:3.5@sha256:dfbd4a3a8ebca874ebd2474f044a0b33600d4523d03b0df76e5c5986cb02d7e8
|
|
|
|
container: Dockerfile
|
|
docker build --no-cache -t $(IMAGE):build .
|
|
|
|
hash: Dockerfile
|
|
find $^ -type f | xargs cat | docker run --rm -i $(SHA_IMAGE) sha1sum - | sed 's/ .*//' > hash
|
|
|
|
push: hash container
|
|
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
|
|
(docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash) && \
|
|
docker push linuxkit/$(IMAGE):$(shell cat hash))
|
|
docker rmi $(IMAGE):build
|
|
rm -f hash
|
|
|
|
tag: hash container
|
|
docker pull linuxkit/$(IMAGE):$(shell cat hash) || \
|
|
docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash)
|
|
docker rmi $(IMAGE):build
|
|
rm -f hash
|
|
|
|
clean:
|
|
rm -rf hash
|
|
|
|
.DELETE_ON_ERROR:
|