Skip to content

Commit

Permalink
Update docker-build.yml to support building and pushing images for mu…
Browse files Browse the repository at this point in the history
…ltiple directories
  • Loading branch information
MathieuMoalic committed Mar 22, 2024
1 parent c131baa commit 485e2ae
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand All @@ -30,17 +33,17 @@ 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}}
type=semver,pattern={{major}}.{{minor}}
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 }}

0 comments on commit 485e2ae

Please sign in to comment.