Add docker image cleanup to clean target

Co-authored-by: Junie <junie@jetbrains.com>
This commit is contained in:
2026-03-15 20:38:38 -07:00
parent cf1f4f94be
commit 124d0cdcd1

View File

@@ -10,6 +10,7 @@
# make clean — remove bin/ and generated artifacts # make clean — remove bin/ and generated artifacts
# make dist — build release tarballs for linux/amd64 and linux/arm64 # make dist — build release tarballs for linux/amd64 and linux/arm64
# make docker — build Docker image tagged mcias:$(VERSION) and mcias:latest # make docker — build Docker image tagged mcias:$(VERSION) and mcias:latest
# make docker-clean — remove local mcias Docker images
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Variables # Variables
@@ -98,6 +99,7 @@ install: build
clean: clean:
rm -rf $(BIN_DIR) rm -rf $(BIN_DIR)
rm -f $(patsubst %.1,%.1.gz,$(MAN_PAGES)) rm -f $(patsubst %.1,%.1.gz,$(MAN_PAGES))
-docker rmi mcias:$(VERSION) mcias:latest 2>/dev/null || true
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# dist — cross-compiled release tarballs for linux/amd64 and linux/arm64 # dist — cross-compiled release tarballs for linux/amd64 and linux/arm64
@@ -134,6 +136,14 @@ dist: man
docker: docker:
docker build -t mcias:$(VERSION) -t mcias:latest . docker build -t mcias:$(VERSION) -t mcias:latest .
# ---------------------------------------------------------------------------
# docker-clean — remove local mcias Docker images
# ---------------------------------------------------------------------------
.PHONY: docker-clean
docker-clean:
-docker rmi mcias:$(VERSION) mcias:latest 2>/dev/null || true
-docker image prune -f --filter label=org.opencontainers.image.title=mcias 2>/dev/null || true
.PHONY: install-local .PHONY: install-local
install-local: build install-local: build
cp bin/* $(HOME)/.local/bin/ cp bin/* $(HOME)/.local/bin/
@@ -153,3 +163,4 @@ help:
@echo " clean Remove build artifacts" @echo " clean Remove build artifacts"
@echo " dist Build release tarballs for Linux amd64/arm64" @echo " dist Build release tarballs for Linux amd64/arm64"
@echo " docker Build Docker image mcias:$(VERSION) and mcias:latest" @echo " docker Build Docker image mcias:$(VERSION) and mcias:latest"
@echo " docker-clean Remove local mcias Docker images"