From 7ffb3de3f2ee6d245dc1d9f483b1d269a63393f2 Mon Sep 17 00:00:00 2001 From: SysAdmin Date: Sun, 28 Sep 2025 19:00:09 +0100 Subject: [PATCH] Fix CI/CD: Force cleanup orphan containers before deployment --- .gitlab-ci.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2cc4b70..9f3e893 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -60,9 +60,14 @@ deploy:vps: # Navigate to deployment directory cd /opt/littleshop - # Stop services - echo "Stopping services..." - docker-compose down + # Force stop all littleshop containers (including orphans) + echo "Stopping all littleshop containers..." + docker stop \$(docker ps -q --filter "name=littleshop") 2>/dev/null || true + docker rm \$(docker ps -aq --filter "name=littleshop") 2>/dev/null || true + + # Stop services with compose (removes networks) + echo "Stopping compose services..." + docker-compose down --remove-orphans || true # Start services with new image echo "Starting services with new image..."