diff --git a/Makefile b/Makefile index 003a276..65a747b 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,8 @@ # Usage: # make up — start the debug stack # make down — stop the debug stack -# make clean — stop and remove all debug containers AND volumes +# make build — (re)build the backend image without starting +# make clean — stop, remove all containers, volumes, and local images # make logs — tail logs for all debug services # make restart — restart the debug stack # ────────────────────────────────────────────────────────────── @@ -25,6 +26,11 @@ DEV_VOLUMES := \ $(PROJECT)_fail2ban-dev-config \ $(PROJECT)_fail2ban-dev-run +# Locally-built images (compose project name + service name). +# Public images (fail2ban, node) are intentionally excluded. +DEV_IMAGES := \ + $(PROJECT)_backend + # Detect available compose binary. COMPOSE := $(shell command -v podman-compose 2>/dev/null \ || echo "podman compose") @@ -32,7 +38,7 @@ COMPOSE := $(shell command -v podman-compose 2>/dev/null \ # Detect available container runtime (podman or docker). RUNTIME := $(shell command -v podman 2>/dev/null || echo "docker") -.PHONY: up down restart logs clean +.PHONY: up down build restart logs clean ## Start the debug stack (detached). up: @@ -42,6 +48,10 @@ up: down: $(COMPOSE) -f $(COMPOSE_FILE) down +## (Re)build the backend image without starting containers. +build: + $(COMPOSE) -f $(COMPOSE_FILE) build + ## Restart the debug stack. restart: down up @@ -49,9 +59,10 @@ restart: down up logs: $(COMPOSE) -f $(COMPOSE_FILE) logs -f -## Stop containers and remove ALL debug volumes (database, node_modules, fail2ban data). -## This returns the environment to a clean first-run state. +## Stop containers, remove ALL debug volumes and locally-built images. +## The next 'make up' will rebuild images from scratch and start fresh. clean: $(COMPOSE) -f $(COMPOSE_FILE) down --remove-orphans $(RUNTIME) volume rm $(DEV_VOLUMES) 2>/dev/null || true - @echo "All debug volumes removed. Run 'make up' to start fresh." + $(RUNTIME) rmi $(DEV_IMAGES) 2>/dev/null || true + @echo "All debug volumes and local images removed. Run 'make up' to rebuild and start fresh."