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:
parent
88f79356f2
commit
47fc78057d
1 changed files with 3 additions and 1 deletions
4
.github/workflows/build-and-deploy.yml
vendored
4
.github/workflows/build-and-deploy.yml
vendored
|
|
@ -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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue