Merge pull request #21910 from dvdksn/bake-composable-attrs

build: composable bake attributes for cache-to/from, output, secret
This commit is contained in:
David Karlsson 2025-01-29 10:03:19 +01:00 committed by GitHub
commit 7e6ba1ede2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 60 additions and 11 deletions

View File

@ -57,15 +57,35 @@ $ docker buildx bake --print
"context": ".",
"dockerfile": "Dockerfile.webapp",
"tags": ["docker.io/username/webapp:latest"],
"cache-from": ["docker.io/username/webapp:cache"],
"cache-to": ["docker.io/username/webapp:cache"]
"cache-from": [
{
"ref": "docker.io/username/webapp:cache",
"type": "registry"
}
],
"cache-to": [
{
"ref": "docker.io/username/webapp:cache",
"type": "registry"
}
]
},
"webapp-release": {
"context": ".",
"dockerfile": "Dockerfile.webapp",
"tags": ["docker.io/username/webapp:latest"],
"cache-from": ["docker.io/username/webapp:cache"],
"cache-to": ["docker.io/username/webapp:cache"],
"cache-from": [
{
"ref": "docker.io/username/webapp:cache",
"type": "registry"
}
],
"cache-to": [
{
"ref": "docker.io/username/webapp:cache",
"type": "registry"
}
],
"platforms": ["linux/amd64", "linux/arm64"]
}
}
@ -180,7 +200,7 @@ $ docker buildx bake --print
{
"group": {
"default": {
"targets": ["aws", "addon"]
"targets": ["addon", "aws"]
}
},
"target": {
@ -192,8 +212,22 @@ $ docker buildx bake --print
"CT_TAG": "bar"
},
"tags": ["ct-addon:foo", "ct-addon:alp"],
"cache-from": ["user/app:cache", "type=local,src=path/to/cache"],
"cache-to": ["type=local,dest=path/to/cache"],
"cache-from": [
{
"ref": "user/app:cache",
"type": "registry"
},
{
"src": "path/to/cache",
"type": "local"
}
],
"cache-to": [
{
"dest": "path/to/cache",
"type": "local"
}
],
"platforms": ["linux/amd64", "linux/arm64"],
"pull": true
},
@ -205,9 +239,22 @@ $ docker buildx bake --print
"CT_TAG": "bar"
},
"tags": ["ct-fake-aws:bar"],
"secret": ["id=mysecret,src=./secret", "id=mysecret2,src=./secret2"],
"secret": [
{
"id": "mysecret",
"src": "./secret"
},
{
"id": "mysecret2",
"src": "./secret2"
}
],
"platforms": ["linux/arm64"],
"output": ["type=docker"],
"output": [
{
"type": "docker"
}
],
"no-cache": true
}
}

View File

@ -59,7 +59,7 @@ attributes:
target "lint" {
inherits = ["_common"]
dockerfile = "./dockerfiles/lint.Dockerfile"
output = ["type=cacheonly"]
output = [{ type = "cacheonly" }]
}
target "docs" {

View File

@ -157,7 +157,9 @@ docker buildx bake -f bake.hcl -f cwd://local.hcl "https://github.com/crazy-max/
},
"target": "build",
"output": [
"type=cacheonly"
{
"type": "cacheonly"
}
]
}
}