feat: try fix ci cd
CI / 🧪 Tests Laravel (push) Successful in 2m13s
CI / 🐳 Build & Push Images (push) Successful in 1m5s

This commit is contained in:
2026-08-13 14:30:46 +02:00
parent 334d94e712
commit 8ef1a3cff8
4 changed files with 43 additions and 20 deletions
+24
View File
@@ -13,6 +13,9 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }} if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configuration SSH - name: Configuration SSH
run: | run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
@@ -23,6 +26,27 @@ jobs:
-H "${{ secrets.DEPLOY_HOST }}" \ -H "${{ secrets.DEPLOY_HOST }}" \
>> ~/.ssh/known_hosts >> ~/.ssh/known_hosts
- name: Synchronisation de la configuration Docker
run: |
ssh \
-i ~/.ssh/id_ed25519 \
${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} \
"mkdir -p /data/stacks/bowli-api/docker/database-backup"
scp \
-i ~/.ssh/id_ed25519 \
docker-compose.prod.yml \
${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:/data/stacks/bowli-api/docker-compose.yml
scp \
-i ~/.ssh/id_ed25519 \
docker/database-backup/restore-production \
${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:/data/stacks/bowli-api/docker/database-backup/restore-production
ssh \
-i ~/.ssh/id_ed25519 \
${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} \
"chmod 755 /data/stacks/bowli-api/docker/database-backup/restore-production"
- name: 🚀 Deploy Docker - name: 🚀 Deploy Docker
run: | run: |
+12 -2
View File
@@ -54,7 +54,7 @@ jobs:
docker: docker:
name: 🐳 Build & Push Image name: 🐳 Build & Push Images
needs: test needs: test
if: ${{ github.ref == 'refs/heads/main' }} if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -75,7 +75,17 @@ jobs:
-t git.leonmorival.xyz/leonm/daily-meal-api:${{ github.sha }} \ -t git.leonmorival.xyz/leonm/daily-meal-api:${{ github.sha }} \
. .
- name: 📤 Push image - name: 🏗️ Build database backup image
run: |
docker build \
-f docker/database-backup/Dockerfile \
-t git.leonmorival.xyz/leonm/daily-meal-postgres-tools:latest \
-t git.leonmorival.xyz/leonm/daily-meal-postgres-tools:${{ github.sha }} \
docker/database-backup
- name: 📤 Push images
run: | run: |
docker push git.leonmorival.xyz/leonm/daily-meal-api:latest docker push git.leonmorival.xyz/leonm/daily-meal-api:latest
docker push git.leonmorival.xyz/leonm/daily-meal-api:${{ github.sha }} docker push git.leonmorival.xyz/leonm/daily-meal-api:${{ github.sha }}
docker push git.leonmorival.xyz/leonm/daily-meal-postgres-tools:latest
docker push git.leonmorival.xyz/leonm/daily-meal-postgres-tools:${{ github.sha }}
+6 -13
View File
@@ -70,22 +70,15 @@ sauvegarde.
```bash ```bash
docker compose config -q docker compose config -q
docker compose build db-backup docker compose pull app db-backup postgres redis meilisearch
docker compose pull app postgres redis meilisearch
docker compose up -d docker compose up -d
docker compose ps docker compose ps
``` ```
`docker compose build db-backup` construit l'image locale contenant `pg_dump`, L'image `db-backup` contient `pg_dump`, `pg_restore`, AWS CLI, le cron et les
`pg_restore`, AWS CLI, le cron et les scripts de `docker/database-backup`. Il faut scripts de `docker/database-backup`. Elle est construite et publiée dans le
l'exécuter au premier déploiement, après une modification de ces scripts ou après registre par la CI. Le serveur la télécharge avec `docker compose pull` et n'a
un changement de version de PostgreSQL. donc pas besoin de posséder le code source ni de construire une image localement.
Pour reconstruire et redémarrer uniquement ce service :
```bash
docker compose up -d --build db-backup
```
### Mettre à jour l'application ### Mettre à jour l'application
@@ -93,7 +86,7 @@ Après avoir changé `IMAGE_TAG` dans `.env` :
```bash ```bash
docker compose config -q docker compose config -q
docker compose pull app docker compose pull app db-backup
docker compose up -d --remove-orphans docker compose up -d --remove-orphans
docker compose ps docker compose ps
``` ```
+1 -5
View File
@@ -27,11 +27,7 @@ x-app-service: &app-service
logging: *default-logging logging: *default-logging
x-database-tools: &database-tools x-database-tools: &database-tools
image: daily-meal-postgres-tools:${POSTGRES_VERSION:-15-alpine} image: git.leonmorival.xyz/leonm/daily-meal-postgres-tools:${IMAGE_TAG:?IMAGE_TAG is required}
build:
context: ./docker/database-backup
args:
POSTGRES_IMAGE: postgres:${POSTGRES_VERSION:-15-alpine}
environment: environment:
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID:?AWS_ACCESS_KEY_ID is required} AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID:?AWS_ACCESS_KEY_ID is required}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION:?AWS_DEFAULT_REGION is required} AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION:?AWS_DEFAULT_REGION is required}