From cb04dbb5425954b5caad265d2962a8234735aa1d Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 22 Feb 2026 19:48:36 -0500 Subject: [PATCH] fix(devops): force container recreation on rebuild to ensure template changes appear Add --force-recreate flag to all build targets that create containers: - build: Force recreation when building all containers - rebuild-app: Force recreation of app container only (fixes template update issue) - build-force: Force recreation even when using --no-cache - test-env-up: Force recreation in test environment This fixes a critical issue where 'make rebuild-app' would build a new image but continue running the old container, causing template changes to not appear. Root cause: podman-compose up --build doesn't recreate containers if they're already running, even when a new image is built. The --force-recreate flag ensures containers are recreated with the new image. BuildKit caching still works as expected - cache is used during image build, while --force-recreate ensures the new image is actually deployed. Changes: - build: Add --force-recreate flag - rebuild-app: Add --force-recreate flag, update success message - build-force: Add --force-recreate flag - test-env-up: Add --force-recreate flag Verified: Template changes now appear immediately after rebuild. --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 4d234e8..e6733c2 100644 --- a/Makefile +++ b/Makefile @@ -68,12 +68,12 @@ test-all: test test-integration # Build and start containers build: - podman compose up --build -d + podman compose up --build --force-recreate -d # Force rebuild without cache (slow, use if needed) build-force: podman compose build --no-cache - podman compose up -d + podman compose up --force-recreate -d # Stop and remove containers clean: @@ -93,8 +93,8 @@ down: # Rebuild app container only (fast, for development) rebuild-app: @echo "Rebuilding app container only (database stays running)..." - podman compose up --build -d app - @echo "✓ App container rebuilt" + podman compose up --build --force-recreate -d app + @echo "✓ App container rebuilt and restarted" # Restart app container (preserves database) restart: @@ -113,7 +113,7 @@ logs: # Start containers with test mode enabled for manual testing test-env-up: @echo "Starting containers with test mode enabled..." - TEST_MODE=true RATE_LIMIT_ENABLED=false REQUESTS_PER_MINUTE=1000 podman compose up --build -d + TEST_MODE=true RATE_LIMIT_ENABLED=false REQUESTS_PER_MINUTE=1000 podman compose up --build --force-recreate -d @echo "Waiting for services to be ready..." @until podman exec bookhoard_db pg_isready -U postgres > /dev/null 2>&1; do sleep 1; done @until podman exec bookhoard curl -sf http://localhost:8765/health > /dev/null 2>&1; do sleep 1; done