diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8d9bb9b..76e9bdb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,11 +22,12 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - uses: docker/metadata-action@v5 id: metadata - with: - images: ghcr.io/${{ github.repository }} - uses: docker/setup-buildx-action@v3 - uses: docker/bake-action@v5 + env: + TAG_BASE: ghcr.io/${{ github.repository }} with: + push: true files: | ./docker-bake.hcl ${{ steps.metadata.outputs.bake-file }} diff --git a/docker-bake.hcl b/docker-bake.hcl index 2fd6f65..05974d7 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,3 +1,5 @@ +variable "TAG_BASE" {} + group "default" { targets = [ "service1", @@ -5,18 +7,18 @@ group "default" { ] } -target "docker-metadata-action" { - output = ["type=registry"] -} +target "docker-metadata-action" {} target "service1" { inherits = ["docker-metadata-action"] context = "." dockerfile = "service1.dockerfile" + tags = [for tag in target.docker-metadata-action.tags : "${TAG_BASE}/service1:${tag}"] } target "service2" { inherits = ["docker-metadata-action"] context = "." dockerfile = "service2.dockerfile" + tags = [for tag in target.docker-metadata-action.tags : "${TAG_BASE}/service2:${tag}"] }