You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+60-17Lines changed: 60 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,8 @@ ___
23
23
*[environment variables](#environment-variables)
24
24
*[Subactions](#subactions)
25
25
*[`matrix`](subaction/matrix)
26
+
*[Notes](#notes)
27
+
*[Source semantics](#source-semantics)
26
28
*[Contributing](#contributing)
27
29
28
30
## Usage
@@ -143,6 +145,31 @@ jobs:
143
145
*.tags=user/app:latest
144
146
```
145
147
148
+
If you point `source` to a subdirectory, relative paths are resolved from that
149
+
subdirectory:
150
+
151
+
```yaml
152
+
-
153
+
name: Build and push
154
+
uses: docker/bake-action@v6
155
+
with:
156
+
source: ./subdir
157
+
files: ./docker-bake.hcl
158
+
```
159
+
160
+
For example, if `./subdir/docker-bake.hcl` contains:
161
+
162
+
```hcl
163
+
target "default" {
164
+
output = ["type=local,dest=./artifacts"]
165
+
}
166
+
```
167
+
168
+
The output will be written to `./subdir/artifacts` in the workspace.
169
+
170
+
> [!NOTE]
171
+
> More info about `source` semantics in the [Source semantics](#source-semantics) section.
172
+
146
173
## Summaries
147
174
148
175
This action generates a [job summary](https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/)
@@ -197,23 +224,22 @@ The following inputs can be used as `step.with` keys
| `workdir` | String | Working directory of execution |
204
-
| `source` | String | Context to build from. Can be either local (`.`) or a [remote bake definition](https://docs.docker.com/build/bake/remote-definition/) |
| `call` | String | Set method for evaluating build (e.g., check) |
207
-
| `files` | List/CSV | List of [bake definition files](https://docs.docker.com/build/customize/bake/file-definition/) |
208
-
| `no-cache` | Bool | Do not use cache when building the image (default `false`) |
209
-
| `pull` | Bool | Always attempt to pull a newer version of the image (default `false`) |
210
-
| `load` | Bool | Load is a shorthand for `--set=*.output=type=docker` (default `false`) |
211
-
| `provenance` | Bool/String | [Provenance](https://docs.docker.com/build/attestations/slsa-provenance/) is a shorthand for `--set=*.attest=type=provenance` |
212
-
| `push` | Bool | Push is a shorthand for `--set=*.output=type=registry` (default `false`) |
213
-
| `sbom` | Bool/String | [SBOM](https://docs.docker.com/build/attestations/sbom/) is a shorthand for `--set=*.attest=type=sbom` |
214
-
| `set` | List | List of [targets values to override](https://docs.docker.com/engine/reference/commandline/buildx_bake/#set) (e.g., `targetpattern.key=value`) |
215
-
| `targets` | List/CSV | List of bake targets (`default` target used if empty) |
216
-
| `github-token` | String | API token used to authenticate to a Git repository for [remote definitions](https://docs.docker.com/build/bake/remote-definition/) (default `${{ github.token }}`) |
| `call` | String | Set method for evaluating build (e.g., check) |
232
+
| `files` | List/CSV | List of [bake definition files](https://docs.docker.com/build/customize/bake/file-definition/) |
233
+
| `no-cache` | Bool | Do not use cache when building the image (default `false`) |
234
+
| `pull` | Bool | Always attempt to pull a newer version of the image (default `false`) |
235
+
| `load` | Bool | Load is a shorthand for `--set=*.output=type=docker` (default `false`) |
236
+
| `provenance` | Bool/String | [Provenance](https://docs.docker.com/build/attestations/slsa-provenance/) is a shorthand for `--set=*.attest=type=provenance` |
237
+
| `push` | Bool | Push is a shorthand for `--set=*.output=type=registry` (default `false`) |
238
+
| `sbom` | Bool/String | [SBOM](https://docs.docker.com/build/attestations/sbom/) is a shorthand for `--set=*.attest=type=sbom` |
239
+
| `set` | List | List of [targets values to override](https://docs.docker.com/engine/reference/commandline/buildx_bake/#set) (e.g., `targetpattern.key=value`) |
240
+
| `source` | String | Build source to use. Supports local path and [remote bake definition](https://docs.docker.com/build/bake/remote-definition/). With a local path, Bake runs from that directory, so all relative paths are resolved from it. See [Source semantics](#source-semantics). |
241
+
| `targets` | List/CSV | List of bake targets (`default` target used if empty) |
242
+
| `github-token` | String | API token used to authenticate to a Git repository for [remote definitions](https://docs.docker.com/build/bake/remote-definition/) (default `${{ github.token }}`) |
217
243
218
244
### outputs
219
245
@@ -236,6 +262,23 @@ The following outputs are available
236
262
237
263
* [`matrix`](subaction/matrix)
238
264
265
+
## Notes
266
+
267
+
### Source semantics
268
+
269
+
`source`accepts either a Git/remote bake definition (for example `{{defaultContext}}` or `{{defaultContext}}:subdir`)
270
+
or a local path (for example `.` or `./subdir`). When `source` is a local path,
271
+
the action runs Bake from that directory (equivalent to `cd <path> && docker buildx bake`).
272
+
273
+
This local path mode affects all relative paths resolved by Bake, not only
274
+
target `context` fields. This includes paths used by local outputs, cache
0 commit comments