diff options
| author | soler_j <soler_j@etna-alternance.net> | 2025-04-27 21:11:01 +0200 |
|---|---|---|
| committer | soler_j <soler_j@etna-alternance.net> | 2025-04-27 21:11:01 +0200 |
| commit | c91ee5eb623102bdf6ea4d56827ab3474f5464dd (patch) | |
| tree | a9b2c8b50b65580ed65b44add42f16f016638a67 | |
| parent | bef502c22566c78040e2c17d8ecaf4dcad650272 (diff) | |
Refactor le workflow de construction Docker pour inclure l'extraction des métadonnées et améliorer la gestion des permissions, tout en mettant à jour les étapes de connexion et de construction de l'image.
| -rw-r--r-- | .github/workflows/build.yml | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 75b136a..28262b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,37 +6,41 @@ on: - main workflow_dispatch: +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: - build: + build-and-push-api-image: runs-on: ubuntu-latest - - env: - IMAGE_NAME: ${{ github.repository }} - + permissions: + contents: read + packages: write steps: - - name: Checkout + - name: Checkout repository uses: actions/checkout@v4 - - name: Set up QEMU uses: docker/setup-qemu-action@v3 - with: - platforms: all - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and push with cache - uses: docker/build-push-action@v5 + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta-api + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Proxy Docker image + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 with: context: . - push: true - tags: ${{ env.IMAGE_NAME }}:latest platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta-api.outputs.tags }} + labels: ${{ steps.meta-api.outputs.labels }} cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:cache cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:cache,mode=max |
