From 0ab86f3063456f2cc016c1433d3f103ad2971c51 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Tue, 24 Nov 2020 15:19:26 -0800 Subject: [PATCH] add image removal to container-clean --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e143339..4321ca6 100755 --- a/Makefile +++ b/Makefile @@ -242,7 +242,15 @@ clean: # @HELP removes built binaries and temporary files clean: container-clean bin-clean container-clean: - rm -rf .container-* .dockerfile-* + @rm -rf .container-* .dockerfile-*; \ + for bin in $(BINS); do \ + docker image exists "$(REGISTRY)/$$bin:$(VERSION)" && \ + docker image rm "$(REGISTRY)/$$bin:$(VERSION)"; \ + for platform in $(ALL_PLATFORMS); do \ + docker image exists "$(REGISTRY)/$$bin:$(VERSION)__$$(echo $$platform | sed 's#/#_#g')" && \ + docker image rm "$(REGISTRY)/$$bin:$(VERSION)__$$(echo $$platform | sed 's#/#_#g')"; \ + done \ + done; true bin-clean: rm -rf .go bin