Enhance deployment workflows to remove old Docker images and prune unused resources
All checks were successful
Deploy Development / deploy (push) Successful in 6m31s

This commit is contained in:
Frank John Begornia
2025-12-18 14:53:13 +08:00
parent e45cfb5ebd
commit 39abf1b5fc
2 changed files with 18 additions and 1 deletions

View File

@@ -47,6 +47,10 @@ jobs:
mkdir -p \$DEPLOY_DIR
cd /tmp
docker load < merchbay_admin.tar.gz
echo 'Removing old merchbay_admin images'
docker images | grep merchbay_admin | grep -v "\$(docker images merchbay_admin:latest -q)" | awk '{print \$3}' | xargs -r docker rmi -f || true
cp docker-compose.yml \$DEPLOY_DIR/
cd \$DEPLOY_DIR
@@ -66,6 +70,12 @@ jobs:
docker compose exec -T app php artisan route:cache
docker compose exec -T app php artisan view:cache
rm -f /tmp/merchbay_admin.tar.gz /tmp/docker-compose.yml
echo 'Pruning unused Docker resources'
docker image prune -af --filter "until=24h" || true
docker container prune -f || true
docker system df
echo 'Production deployment completed successfully!'
echo 'Application available at: https://merchbay.com'
"