Files
BanGUI/Makefile
Lukas da95a399a1 chore: remove local images in make clean, add build target
clean now removes the locally-built backend image (bangui-dev_backend)
in addition to volumes, so the next 'make up' rebuilds from scratch
ensuring code changes land in the new image.
Public images (fail2ban, node:22-alpine) are left untouched.
Added standalone 'make build' target for explicit rebuilds.
2026-03-01 19:45:14 +01:00

69 lines
2.4 KiB
Makefile

# ──────────────────────────────────────────────────────────────
# BanGUI — Project Makefile
#
# Compatible with both Docker Compose and Podman Compose.
# Auto-detects which compose binary is available.
#
# Usage:
# make up — start the debug stack
# make down — stop the debug stack
# 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
# ──────────────────────────────────────────────────────────────
COMPOSE_FILE := Docker/compose.debug.yml
# Compose project name (matches `name:` in compose.debug.yml).
PROJECT := bangui-dev
# All named volumes declared in compose.debug.yml.
# Compose prefixes them with the project name.
DEV_VOLUMES := \
$(PROJECT)_bangui-dev-data \
$(PROJECT)_frontend-node-modules \
$(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")
# Detect available container runtime (podman or docker).
RUNTIME := $(shell command -v podman 2>/dev/null || echo "docker")
.PHONY: up down build restart logs clean
## Start the debug stack (detached).
up:
$(COMPOSE) -f $(COMPOSE_FILE) up -d
## Stop the debug stack.
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
## Tail logs for all debug services.
logs:
$(COMPOSE) -f $(COMPOSE_FILE) logs -f
## 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
$(RUNTIME) rmi $(DEV_IMAGES) 2>/dev/null || true
@echo "All debug volumes and local images removed. Run 'make up' to rebuild and start fresh."