From 178a56fd1c040859acde968ae60cb096ba448e14 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Mon, 9 Jan 2023 15:41:00 +0000 Subject: [PATCH 1/3] bake: fix typo in configuring build Signed-off-by: Justin Chadwell --- build/bake/configuring-build.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/bake/configuring-build.md b/build/bake/configuring-build.md index 9c267861a0..ec8d062a48 100644 --- a/build/bake/configuring-build.md +++ b/build/bake/configuring-build.md @@ -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) From e7a93fa64ff68b11d0decfd302e5c605208842cb Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Mon, 9 Jan 2023 15:41:47 +0000 Subject: [PATCH 2/3] bake: document target interpolation Signed-off-by: Justin Chadwell --- build/bake/configuring-build.md | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/build/bake/configuring-build.md b/build/bake/configuring-build.md index ec8d062a48..6b520e15c6 100644 --- a/build/bake/configuring-build.md +++ b/build/bake/configuring-build.md @@ -93,6 +93,55 @@ $ 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 +``` +```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 From 123eea01376089d048a856c5be054ee00f44ff4e Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Mon, 9 Jan 2023 18:51:12 +0000 Subject: [PATCH 3/3] lint: add empty line between console and json code blocks Signed-off-by: Justin Chadwell --- build/bake/compose-file.md | 3 +++ build/bake/configuring-build.md | 5 +++++ build/bake/file-definition.md | 3 +++ build/bake/hcl-funcs.md | 7 +++++++ config/containers/logging/splunk.md | 2 ++ 5 files changed, 20 insertions(+) diff --git a/build/bake/compose-file.md b/build/bake/compose-file.md index 5d78765f71..b220d8e943 100644 --- a/build/bake/compose-file.md +++ b/build/bake/compose-file.md @@ -40,6 +40,7 @@ services: ```console $ docker buildx bake --print ``` + ```json { "group": { @@ -124,6 +125,7 @@ TAG=v1.1.0 ```console $ docker buildx bake --print ``` + ```json { "group": { @@ -200,6 +202,7 @@ services: ```console $ docker buildx bake --print ``` + ```json { "group": { diff --git a/build/bake/configuring-build.md b/build/bake/configuring-build.md index 6b520e15c6..4222936004 100644 --- a/build/bake/configuring-build.md +++ b/build/bake/configuring-build.md @@ -38,6 +38,7 @@ You can use this file directly: ```console $ docker buildx bake --print app ``` + ```json { "group": { @@ -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": { @@ -113,6 +115,7 @@ You can use this file directly: ```console $ docker buildx bake --print foo bar ``` + ```json { "group": { @@ -159,6 +162,7 @@ target "app" { ```console $ docker buildx bake --set app.args.mybuildarg=bar --set app.platform=linux/arm64 app --print ``` + ```json { "group": { @@ -247,6 +251,7 @@ target "app" { ```console $ docker buildx bake -f docker-bake1.hcl -f docker-bake2.hcl --print app ``` + ```json { "group": { diff --git a/build/bake/file-definition.md b/build/bake/file-definition.md index 75b39c5481..b6a68eeaa0 100644 --- a/build/bake/file-definition.md +++ b/build/bake/file-definition.md @@ -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": { @@ -383,6 +384,7 @@ EOT ```console $ docker buildx bake "https://github.com/tonistiigi/buildx.git#remote-test" --print ``` + ```json { "target": { @@ -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": { diff --git a/build/bake/hcl-funcs.md b/build/bake/hcl-funcs.md index 36ce8f63ba..3176bbd784 100644 --- a/build/bake/hcl-funcs.md +++ b/build/bake/hcl-funcs.md @@ -51,6 +51,7 @@ alternatively, in json format: ```console $ docker buildx bake --print webapp ``` + ```json { "group": { @@ -75,6 +76,7 @@ $ docker buildx bake --print webapp ```console $ TAG=$(git rev-parse --short HEAD) docker buildx bake --print webapp ``` + ```json { "group": { @@ -121,6 +123,7 @@ target "webapp" { ```console $ docker buildx bake --print webapp ``` + ```json { "group": { @@ -168,6 +171,7 @@ target "webapp" { ```console $ docker buildx bake --print webapp ``` + ```json { "group": { @@ -217,6 +221,7 @@ target "webapp" { ```console $ docker buildx bake --print webapp ``` + ```json { "group": { @@ -262,6 +267,7 @@ target "webapp" { ```console $ docker buildx bake --print webapp ``` + ```json { "group": { @@ -309,6 +315,7 @@ target "app" { ```console $ docker buildx bake --print app ``` + ```json { "group": { diff --git a/config/containers/logging/splunk.md b/config/containers/logging/splunk.md index 6ffba4f4cf..9391796aa1 100644 --- a/config/containers/logging/splunk.md +++ b/config/containers/logging/splunk.md @@ -131,6 +131,7 @@ For example: "line": "my message" } ``` + ```json { "attrs": { @@ -161,6 +162,7 @@ object. If it cannot parse the message, it is sent `inline`. For example: "line": "my message" } ``` + ```json { "attrs": {