Skip to content

Commit

Permalink
docs: using bake with remote and local metadata definition
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Mar 18, 2024
1 parent 7535934 commit d9192c4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -455,3 +455,30 @@ jobs:
-
name: Print envs
run: env|sort

bake-cwd:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
-
name: Docker meta
id: docker_meta
uses: ./
-
name: Build
uses: docker/bake-action@v4
with:
source: "{{defaultContext}}"
files: |
./test/docker-bake.hcl
cwd://${{ steps.docker_meta.outputs.bake-file-tags }}
cwd://${{ steps.docker_meta.outputs.bake-file-labels }}
targets: |
release
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ jobs:
type=sha
-
name: Build
uses: docker/bake-action@v3
uses: docker/bake-action@v4
with:
files: |
./docker-bake.hcl
Expand Down Expand Up @@ -270,7 +270,7 @@ similar to the previous one:
```yaml
-
name: Build
uses: docker/bake-action@v3
uses: docker/bake-action@v4
with:
files: |
./docker-bake.hcl
Expand All @@ -279,6 +279,22 @@ similar to the previous one:
targets: build
```

If you're building a [remote Bake definition](https://docs.docker.com/build/bake/remote-definition/)
using a [Git context](https://github.com/docker/bake-action?tab=readme-ov-file#git-context),
you can specify the metadata bake definition with the `cwd://` prefix:

```yaml
-
name: Build
uses: docker/bake-action@v4
with:
source: "${{ github.server_url }}/${{ github.repository }}.git#${{ github.ref }}"
files: |
./docker-bake.hcl
cwd://${{ steps.meta.outputs.bake-file }}
targets: build
```

## Customizing

### inputs
Expand Down Expand Up @@ -948,7 +964,7 @@ The same can be done with the [`bake-action`](https://github.com/docker/bake-act
images: name/app
-
name: Build
uses: docker/bake-action@v3
uses: docker/bake-action@v4
with:
files: |
./docker-bake.hcl
Expand Down

0 comments on commit d9192c4

Please sign in to comment.