Fix deployment: properly stop containers before recreating

- Add compose down before pull/up to avoid container name conflicts
- Improve toolchain caching: only install if not already present
- Add log directory mount for easy error monitoring
- Scope Buildx cache per image for better hit rates
This commit is contained in:
Christbru 2025-10-18 21:37:47 -05:00
commit 47fc78057d

View file

@ -96,7 +96,9 @@ jobs:
export MYSQL_PASSWORD='${{ secrets.MYSQL_PASSWORD }}' export MYSQL_PASSWORD='${{ secrets.MYSQL_PASSWORD }}'
export MYSQL_ROOT_PASSWORD='${{ secrets.MYSQL_ROOT_PASSWORD }}' export MYSQL_ROOT_PASSWORD='${{ secrets.MYSQL_ROOT_PASSWORD }}'
export IMAGE_TAG=${{ github.sha }} export IMAGE_TAG=${{ github.sha }}
# Stop and remove old containers before pulling new images
compose -f docker-compose.prod.yml down
compose -f docker-compose.prod.yml pull compose -f docker-compose.prod.yml pull
compose -f docker-compose.prod.yml up -d --force-recreate compose -f docker-compose.prod.yml up -d
# Security hygiene: remove GHCR credentials after pulling # Security hygiene: remove GHCR credentials after pulling
docker logout ghcr.io || true docker logout ghcr.io || true