aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorRichard Mortier <mort@cantab.net>2019-03-26 11:59:26 +0000
committerRichard Mortier <mort@cantab.net>2019-03-26 11:59:26 +0000
commit5516721cc61695dcd3b427e4db546e9281d6c9fe (patch)
tree5e254492111eac0e897499492fa94ddd214a0835 /Makefile
parent199fdef7fd084d3e9ca98e570b5e0120a67dab34 (diff)
downloaddocker-abuild-5516721cc61695dcd3b427e4db546e9281d6c9fe.tar.bz2
docker-abuild-5516721cc61695dcd3b427e4db546e9281d6c9fe.tar.xz
abuild: support cross-invocation caching using named volumes
Signed-off-by: Richard Mortier <mort@cantab.net>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 11 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index e0befe9..fede06e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,32 @@
.DEFAULT: build
+IMG = mor1/abuild
+VOLS = bin etc lib sbin usr var
TAGS := $(shell \
curl -s https://registry.hub.docker.com/v1/repositories/alpine/tags \
| jq -r '.[].name' \
)
+TAGS = edge
.PHONY: build
build: $(patsubst %, build-%, $(TAGS))
+ sed 's/%%ALPINE_VOLUMES%%/$(VOLS)/' abuild.in >| abuild
.PHONY: build-%
build-%:
sed 's/%%ALPINE_TAG%%/$*/' Dockerfile.in >| Dockerfile
- DOCKER_BUILDKIT=1 docker build $$DOCKER_FLAGS -t mor1/abuild:$* .
+ for v in $(VOLS) ; do docker volume create alpine-$*-$$v ; done
+ DOCKER_BUILDKIT=1 docker build $$DOCKER_FLAGS -t $(IMG):$* .
$(RM) Dockerfile
.PHONY: push
push: build
- docker push $(DOCKER_FLAGS) mor1/abuild
+ docker push $(DOCKER_FLAGS) $(IMG)
.PHONY: clean
clean:
$(RM) Dockerfile
+
+.PHONY: distclean
+distclean: clean
+ docker rmi -f $$(docker images -q $(IMG))