From e68a53651a58d28dc65e24955b09e9753796271f Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Mon, 23 Feb 2026 20:24:16 -0500 Subject: [PATCH] refactor(devops): reorganize rebuild targets for clarity -- Rename 'build' to 'rebuild' for clarity (rebuilds all containers) -- Rename 'build-force' to 'rebuild-force' for consistency -- Add 'rebuild-app-force' target for app-only rebuild without cache -- Add 'rebuild-force-db' target that DELETES database for clean rebuild -- Improve help text to clarify what each target does -- Remove circular dependency (rebuild no longer depends on clean) -- All rebuild targets now preserve database unless explicitly stated --- Makefile | 62 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index e6733c2..600cd9f 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: help test test-integration test-all build build-force clean rebuild rebuild-app restart up down logs ps test-env-up test-env-down verify-guidelines verify-quick +.PHONY: help test test-integration test-all rebuild rebuild-force rebuild-app rebuild-app-force rebuild-force-db clean restart up down logs ps test-env-up test-env-down verify-guidelines verify-quick # Include .env file for environment variables (single source of truth) # Ignore if .env doesn't exist yet @@ -12,13 +12,15 @@ help: @echo "Available targets:" @echo "" @echo "Development:" - @echo " make up - Start containers (if already built)" - @echo " make build - Build and start all containers" - @echo " make rebuild-app - Rebuild app container only (fast, for development)" - @echo " make restart - Restart app container (preserves db)" - @echo " make down - Stop all containers" - @echo " make rebuild - Clean, rebuild, and start all containers" - @echo " make build-force - Force rebuild without cache (slow, use if needed)" + @echo " make up - Start containers (if already built)" + @echo " make rebuild - Rebuild all containers (database preserved)" + @echo " make rebuild-force - Rebuild all containers, no cache (database preserved)" + @echo " make rebuild-app - Rebuild app container only (fast, database preserved)" + @echo " make rebuild-app-force - Rebuild app container only, no cache (database preserved)" + @echo " make rebuild-force-db - Rebuild all containers, no cache (DELETES database)" + @echo " make restart - Restart app container (preserves db)" + @echo " make down - Stop all containers (preserves volumes)" + @echo " make clean - Stop and remove all containers and volumes" @echo "" @echo "Status & Logs:" @echo " make ps - Show container status" @@ -66,22 +68,44 @@ test-integration: # Run all tests test-all: test test-integration -# Build and start containers -build: - podman compose up --build --force-recreate -d +# Rebuild app container only (preserve DB, with cache) +rebuild-app: + @echo "Rebuilding app container (database stays running)..." + podman compose up --build --force-recreate -d app + @echo "✓ App container rebuilt and restarted" -# Force rebuild without cache (slow, use if needed) -build-force: +# Rebuild app container only (preserve DB, no cache) +rebuild-app-force: + @echo "Force rebuilding app container (database stays running, no cache)..." + podman compose build --no-cache app + podman compose up --force-recreate -d app + @echo "✓ App container rebuilt and restarted" + +# Rebuild all containers (preserve DB, with cache) +rebuild: + @echo "Rebuilding all containers (database preserved)..." + podman compose up --build --force-recreate -d + @echo "✓ All containers rebuilt and restarted" + +# Rebuild all containers (preserve DB, no cache) +rebuild-force: + @echo "Force rebuilding all containers (database preserved, no cache)..." podman compose build --no-cache podman compose up --force-recreate -d + @echo "✓ All containers rebuilt and restarted" + +# Rebuild all containers (remove DB, no cache) +rebuild-force-db: + @echo "Force rebuilding all containers (database will be DELETED, no cache)..." + podman compose down -v + podman compose build --no-cache + podman compose up --force-recreate -d + @echo "✓ All containers rebuilt and restarted" # Stop and remove containers clean: podman compose down -v -# Clean rebuild (remove volumes, rebuild, start) -rebuild: clean build - # Quick start (if already built) up: podman compose up -d @@ -90,12 +114,6 @@ up: down: podman compose down -# Rebuild app container only (fast, for development) -rebuild-app: - @echo "Rebuilding app container only (database stays running)..." - podman compose up --build --force-recreate -d app - @echo "✓ App container rebuilt and restarted" - # Restart app container (preserves database) restart: @echo "Restarting app container (database stays running)..."