fix: Correct production deployment to use pre-built Docker images

CRITICAL: This fixes the deployment issue where changes weren't appearing on production

Changes:
- Update docker-compose.prod.yml to use ghcr.io pre-built images instead of local builds
- Fix deployment script to pull latest images rather than building locally
- Add proper GitHub Container Registry authentication
- Remove --build flag that was causing deployment to use stale local code

This should resolve the issue where www.vhtv-stiftung.de wasn't showing the new Verpachtung features.
This commit is contained in:
Stiftung Development
2025-09-15 22:08:13 +02:00
parent 209da869c6
commit 0d92fe3d32
2 changed files with 14 additions and 12 deletions

View File

@@ -185,11 +185,13 @@ jobs:
uses: appleboy/ssh-action@v1.0.3 uses: appleboy/ssh-action@v1.0.3
env: env:
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ github.actor }}
with: with:
host: ${{ secrets.PROD_HOST }} host: ${{ secrets.PROD_HOST }}
username: ${{ secrets.PROD_USERNAME }} username: ${{ secrets.PROD_USERNAME }}
key: ${{ secrets.PROD_SSH_KEY }} key: ${{ secrets.PROD_SSH_KEY }}
envs: DEPLOY_TOKEN envs: DEPLOY_TOKEN,GITHUB_TOKEN,GITHUB_ACTOR
script: | script: |
cd /opt/stiftung cd /opt/stiftung
@@ -199,11 +201,17 @@ jobs:
# Copy production docker compose file # Copy production docker compose file
cp deploy-production/docker-compose.prod.yml docker-compose.yml cp deploy-production/docker-compose.prod.yml docker-compose.yml
# Login to GitHub Container Registry
echo $GITHUB_TOKEN | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
# Pull latest images
docker-compose pull
# Stop containers # Stop containers
docker-compose down docker-compose down
# Start containers with rebuild # Start containers with latest images
docker-compose up -d --build docker-compose up -d
# Wait for containers to be ready # Wait for containers to be ready
echo "Waiting for containers to start..." echo "Waiting for containers to start..."

View File

@@ -36,9 +36,7 @@ services:
cpus: '0.5' cpus: '0.5'
web: web:
build: image: ghcr.io/remmerinio/stiftung-management-system:main
context: ../app
dockerfile: Dockerfile
restart: unless-stopped restart: unless-stopped
environment: environment:
- DEBUG=False - DEBUG=False
@@ -66,9 +64,7 @@ services:
- "127.0.0.1:8000:8000" - "127.0.0.1:8000:8000"
worker: worker:
build: image: ghcr.io/remmerinio/stiftung-management-system:main
context: ../app
dockerfile: Dockerfile
restart: unless-stopped restart: unless-stopped
command: celery -A core worker -l info --concurrency=2 command: celery -A core worker -l info --concurrency=2
environment: environment:
@@ -93,9 +89,7 @@ services:
cpus: '0.5' cpus: '0.5'
beat: beat:
build: image: ghcr.io/remmerinio/stiftung-management-system:main
context: ./app
dockerfile: Dockerfile
restart: unless-stopped restart: unless-stopped
command: celery -A core beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler command: celery -A core beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler
environment: environment: