From c55151511d9d70007667faed85805537808ab168 Mon Sep 17 00:00:00 2001 From: skylanix Date: Tue, 12 Aug 2025 15:31:17 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20build=20Docker=20automatis=C3=A9=20via?= =?UTF-8?q?=20GitHub=20Actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Ajout workflow GitHub Actions pour build automatique des images Docker - Configuration publication sur GitHub Container Registry (ghcr.io) - Mise à jour docker-compose.yml pour utiliser l'image hébergée - Support build multi-plateforme et étiquetage automatique --- .github/workflows/docker-build.yml | 51 ++++++++++++++++++++++++++++++ docker-compose.yml | 3 +- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docker-build.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000..37b9ff1 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,51 @@ +name: Build and Push Docker Image + +on: + push: + branches: [ main ] + tags: [ 'v*' ] + pull_request: + branches: [ main ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: skylanix/mamiehenriette + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index c5f75bf..7941058 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,8 @@ services: mamiehenriette: container_name: MamieHenriette - build: . + image: ghcr.io/skylanix/mamiehenriette:latest + # build: . restart: on-failure environment: - ENABLE_ZABBIX=false