This commit is contained in:
parent
21a87a3eb3
commit
fb6a61d5b6
43
.gitea/workflows/deploy.yml
Normal file
43
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
name: Build and Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Docker CLI
|
||||
run: |
|
||||
apt-get update && apt-get install -y docker.io
|
||||
|
||||
- name: Build production image
|
||||
run: |
|
||||
docker build \
|
||||
--target frankenphp_prod \
|
||||
-t mangarr:latest \
|
||||
-t mangarr:${{ gitea.sha }} \
|
||||
.
|
||||
|
||||
- name: Deploy containers
|
||||
run: |
|
||||
# Redemarrer le container principal avec la nouvelle image
|
||||
docker stop mangarr mangarr-worker 2>/dev/null || true
|
||||
docker rm mangarr mangarr-worker 2>/dev/null || true
|
||||
# Portainer va recréer les containers via la stack
|
||||
echo "Image mangarr:latest buildée avec succès"
|
||||
echo "Redéployez la stack via : deploy-stacks.sh mangarr"
|
||||
|
||||
- name: Run migrations
|
||||
run: |
|
||||
# Attendre que le container soit prêt
|
||||
sleep 10
|
||||
docker exec mangarr php bin/console doctrine:migrations:migrate --no-interaction 2>/dev/null || echo "Migrations: container pas encore prêt, lancer manuellement"
|
||||
docker exec mangarr php bin/console cache:clear --env=prod 2>/dev/null || true
|
||||
Reference in New Issue
Block a user