Skip to content

Commit 7e6ba1e

Browse files
authored
Merge pull request #21910 from dvdksn/bake-composable-attrs
build: composable bake attributes for cache-to/from, output, secret
2 parents ee59422 + 12d642b commit 7e6ba1e

File tree

3 files changed

+60
-11
lines changed

3 files changed

+60
-11
lines changed

content/manuals/build/bake/compose-file.md

Lines changed: 56 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,35 @@ $ docker buildx bake --print
5757
"context": ".",
5858
"dockerfile": "Dockerfile.webapp",
5959
"tags": ["docker.io/username/webapp:latest"],
60-
"cache-from": ["docker.io/username/webapp:cache"],
61-
"cache-to": ["docker.io/username/webapp:cache"]
60+
"cache-from": [
61+
{
62+
"ref": "docker.io/username/webapp:cache",
63+
"type": "registry"
64+
}
65+
],
66+
"cache-to": [
67+
{
68+
"ref": "docker.io/username/webapp:cache",
69+
"type": "registry"
70+
}
71+
]
6272
},
6373
"webapp-release": {
6474
"context": ".",
6575
"dockerfile": "Dockerfile.webapp",
6676
"tags": ["docker.io/username/webapp:latest"],
67-
"cache-from": ["docker.io/username/webapp:cache"],
68-
"cache-to": ["docker.io/username/webapp:cache"],
77+
"cache-from": [
78+
{
79+
"ref": "docker.io/username/webapp:cache",
80+
"type": "registry"
81+
}
82+
],
83+
"cache-to": [
84+
{
85+
"ref": "docker.io/username/webapp:cache",
86+
"type": "registry"
87+
}
88+
],
6989
"platforms": ["linux/amd64", "linux/arm64"]
7090
}
7191
}
@@ -180,7 +200,7 @@ $ docker buildx bake --print
180200
{
181201
"group": {
182202
"default": {
183-
"targets": ["aws", "addon"]
203+
"targets": ["addon", "aws"]
184204
}
185205
},
186206
"target": {
@@ -192,8 +212,22 @@ $ docker buildx bake --print
192212
"CT_TAG": "bar"
193213
},
194214
"tags": ["ct-addon:foo", "ct-addon:alp"],
195-
"cache-from": ["user/app:cache", "type=local,src=path/to/cache"],
196-
"cache-to": ["type=local,dest=path/to/cache"],
215+
"cache-from": [
216+
{
217+
"ref": "user/app:cache",
218+
"type": "registry"
219+
},
220+
{
221+
"src": "path/to/cache",
222+
"type": "local"
223+
}
224+
],
225+
"cache-to": [
226+
{
227+
"dest": "path/to/cache",
228+
"type": "local"
229+
}
230+
],
197231
"platforms": ["linux/amd64", "linux/arm64"],
198232
"pull": true
199233
},
@@ -205,9 +239,22 @@ $ docker buildx bake --print
205239
"CT_TAG": "bar"
206240
},
207241
"tags": ["ct-fake-aws:bar"],
208-
"secret": ["id=mysecret,src=./secret", "id=mysecret2,src=./secret2"],
242+
"secret": [
243+
{
244+
"id": "mysecret",
245+
"src": "./secret"
246+
},
247+
{
248+
"id": "mysecret2",
249+
"src": "./secret2"
250+
}
251+
],
209252
"platforms": ["linux/arm64"],
210-
"output": ["type=docker"],
253+
"output": [
254+
{
255+
"type": "docker"
256+
}
257+
],
211258
"no-cache": true
212259
}
213260
}

content/manuals/build/bake/inheritance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ attributes:
5959
target "lint" {
6060
inherits = ["_common"]
6161
dockerfile = "./dockerfiles/lint.Dockerfile"
62-
output = ["type=cacheonly"]
62+
output = [{ type = "cacheonly" }]
6363
}
6464
6565
target "docs" {

content/manuals/build/bake/remote-definition.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ docker buildx bake -f bake.hcl -f cwd://local.hcl "https://github.com/crazy-max/
157157
},
158158
"target": "build",
159159
"output": [
160-
"type=cacheonly"
160+
{
161+
"type": "cacheonly"
162+
}
161163
]
162164
}
163165
}

0 commit comments

Comments
 (0)