Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build/bake/compose-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ services:
```console
$ docker buildx bake --print
```

```json
{
"group": {
Expand Down Expand Up @@ -124,6 +125,7 @@ TAG=v1.1.0
```console
$ docker buildx bake --print
```

```json
{
"group": {
Expand Down Expand Up @@ -200,6 +202,7 @@ services:
```console
$ docker buildx bake --print
```

```json
{
"group": {
Expand Down
58 changes: 56 additions & 2 deletions build/bake/configuring-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ redirect_from:
- /build/customize/bake/configuring-build/
---

Bake supports loading build definition from files, but sometimes you need even
more flexibility to configure this definition.
Bake supports loading build definitions from files, but sometimes you need even
more flexibility to configure these definitions.

For this use case, you can define variables inside the bake files that can be
set by the user with environment variables or by [attribute definitions](#global-scope-attributes)
Expand Down Expand Up @@ -38,6 +38,7 @@ You can use this file directly:
```console
$ docker buildx bake --print app
```

```json
{
"group": {
Expand Down Expand Up @@ -72,6 +73,7 @@ And invoke bake together with both of the files:
```console
$ docker buildx bake -f docker-bake.hcl -f env.hcl --print app
```

```json
{
"group": {
Expand All @@ -93,6 +95,56 @@ $ docker buildx bake -f docker-bake.hcl -f env.hcl --print app
}
```

You can also refer to attributes defined as part of other targets, to help
reduce duplication between targets.

```hcl
# docker-bake.hcl
target "foo" {
dockerfile = "${target.foo.name}.Dockerfile"
tags = [target.foo.name]
}
target "bar" {
dockerfile = "${target.foo.name}.Dockerfile"
tags = [target.bar.name]
}
```

You can use this file directly:

```console
$ docker buildx bake --print foo bar
```
Comment thread
jedevc marked this conversation as resolved.

```json
{
"group": {
"default": {
"targets": [
"foo",
"bar"
]
}
},
"target": {
"foo": {
"context": ".",
"dockerfile": "foo.Dockerfile",
"tags": [
"foo"
]
},
"bar": {
"context": ".",
"dockerfile": "foo.Dockerfile",
"tags": [
"bar"
]
}
}
}
```

## From command line

You can also override target configurations from the command line with the
Expand All @@ -110,6 +162,7 @@ target "app" {
```console
$ docker buildx bake --set app.args.mybuildarg=bar --set app.platform=linux/arm64 app --print
```

```json
{
"group": {
Expand Down Expand Up @@ -198,6 +251,7 @@ target "app" {
```console
$ docker buildx bake -f docker-bake1.hcl -f docker-bake2.hcl --print app
```

```json
{
"group": {
Expand Down
3 changes: 3 additions & 0 deletions build/bake/file-definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ $ docker buildx bake "https://github.com/docker/cli.git#v20.10.11" --print
#1 2.022 * [new tag] v20.10.11 -> v20.10.11
#1 DONE 2.9s
```

```json
{
"group": {
Expand Down Expand Up @@ -383,6 +384,7 @@ EOT
```console
$ docker buildx bake "https://github.com/tonistiigi/buildx.git#remote-test" --print
```

```json
{
"target": {
Expand Down Expand Up @@ -414,6 +416,7 @@ $ docker buildx bake "https://github.com/tonistiigi/buildx.git#remote-test" "htt
#1 0.429 577303add004dd7efeb13434d69ea030d35f7888 refs/heads/remote-test
#1 CACHED
```

```json
{
"target": {
Expand Down
7 changes: 7 additions & 0 deletions build/bake/hcl-funcs.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ alternatively, in json format:
```console
$ docker buildx bake --print webapp
```

```json
{
"group": {
Expand All @@ -75,6 +76,7 @@ $ docker buildx bake --print webapp
```console
$ TAG=$(git rev-parse --short HEAD) docker buildx bake --print webapp
```

```json
{
"group": {
Expand Down Expand Up @@ -121,6 +123,7 @@ target "webapp" {
```console
$ docker buildx bake --print webapp
```

```json
{
"group": {
Expand Down Expand Up @@ -168,6 +171,7 @@ target "webapp" {
```console
$ docker buildx bake --print webapp
```

```json
{
"group": {
Expand Down Expand Up @@ -217,6 +221,7 @@ target "webapp" {
```console
$ docker buildx bake --print webapp
```

```json
{
"group": {
Expand Down Expand Up @@ -262,6 +267,7 @@ target "webapp" {
```console
$ docker buildx bake --print webapp
```

```json
{
"group": {
Expand Down Expand Up @@ -309,6 +315,7 @@ target "app" {
```console
$ docker buildx bake --print app
```

```json
{
"group": {
Expand Down
2 changes: 2 additions & 0 deletions config/containers/logging/splunk.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ For example:
"line": "my message"
}
```

```json
{
"attrs": {
Expand Down Expand Up @@ -161,6 +162,7 @@ object. If it cannot parse the message, it is sent `inline`. For example:
"line": "my message"
}
```

```json
{
"attrs": {
Expand Down