From 485e2ae19973388d6dc1ae4b497a70ae7118d4ca Mon Sep 17 00:00:00 2001 From: Mathieu Moalic Date: Fri, 22 Mar 2024 13:02:02 +0100 Subject: [PATCH] Update docker-build.yml to support building and pushing images for multiple directories --- .github/workflows/docker-build.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 08057ad..ddfcbeb 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -7,8 +7,11 @@ on: name: build-image-push-ghcr jobs: - build-image-push-ghcr: + build-and-push: runs-on: ubuntu-latest + strategy: + matrix: + directory: ['frontend', 'manager', 'node'] permissions: contents: read packages: write @@ -19,7 +22,7 @@ jobs: - name: Log into ghcr.io if: github.event_name != 'pull_request' - uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d + uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.actor }} @@ -30,7 +33,7 @@ jobs: uses: docker/metadata-action@v5 with: images: | - ghcr.io/${{ github.repository }}/frontend + ghcr.io/${{ github.repository }}/${{ matrix.directory }} tags: | type=ref,event=pr type=semver,pattern={{version}} @@ -38,9 +41,9 @@ jobs: type=semver,pattern={{major}} - name: Build and push image - uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 + uses: docker/build-push-action@v2 with: - context: ./frontend - push: ${{ github.event_name != 'pull_request' }} + context: ./${{ matrix.directory }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}