Merge pull request #2953 from dvdksn/docs-bake-composable-attrs

docs: update bake reference to use composable attrs
This commit is contained in:
CrazyMax 2025-01-29 10:44:05 +01:00 committed by GitHub
commit cacb4fb9b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -285,19 +285,11 @@ The key takes a list of annotations, in the format of `KEY=VALUE`.
```hcl ```hcl
target "default" { target "default" {
output = ["type=image,name=foo"] output = [{ type = "image", name = "foo" }]
annotations = ["org.opencontainers.image.authors=dvdksn"] annotations = ["org.opencontainers.image.authors=dvdksn"]
} }
``` ```
is the same as
```hcl
target "default" {
output = ["type=image,name=foo,annotation.org.opencontainers.image.authors=dvdksn"]
}
```
By default, the annotation is added to image manifests. You can configure the By default, the annotation is added to image manifests. You can configure the
level of the annotations by adding a prefix to the annotation, containing a level of the annotations by adding a prefix to the annotation, containing a
comma-separated list of all the levels that you want to annotate. The following comma-separated list of all the levels that you want to annotate. The following
@ -305,7 +297,7 @@ example adds annotations to both the image index and manifests.
```hcl ```hcl
target "default" { target "default" {
output = ["type=image,name=foo"] output = [{ type = "image", name = "foo" }]
annotations = ["index,manifest:org.opencontainers.image.authors=dvdksn"] annotations = ["index,manifest:org.opencontainers.image.authors=dvdksn"]
} }
``` ```
@ -321,8 +313,13 @@ This attribute accepts the long-form CSV version of attestation parameters.
```hcl ```hcl
target "default" { target "default" {
attest = [ attest = [
"type=provenance,mode=min", {
"type=sbom" type = "provenance",
mode = "max",
},
{
type = "sbom",
}
] ]
} }
``` ```
@ -338,8 +335,15 @@ This takes a list value, so you can specify multiple cache sources.
```hcl ```hcl
target "app" { target "app" {
cache-from = [ cache-from = [
"type=s3,region=eu-west-1,bucket=mybucket", {
"user/repo:cache", type = "s3",
region = "eu-west-1",
bucket = "mybucket"
},
{
type = "registry",
ref = "user/repo:cache"
}
] ]
} }
``` ```
@ -355,8 +359,14 @@ This takes a list value, so you can specify multiple cache export targets.
```hcl ```hcl
target "app" { target "app" {
cache-to = [ cache-to = [
"type=s3,region=eu-west-1,bucket=mybucket", {
"type=inline" type = "s3",
region = "eu-west-1",
bucket = "mybucket"
},
{
type = "inline",
}
] ]
} }
``` ```
@ -863,7 +873,7 @@ The following example configures the target to use a cache-only output,
```hcl ```hcl
target "default" { target "default" {
output = ["type=cacheonly"] output = [{ type = "cacheonly" }]
} }
``` ```
@ -903,8 +913,8 @@ variable "HOME" {
target "default" { target "default" {
secret = [ secret = [
"type=env,id=KUBECONFIG", { type = "env", id = "KUBECONFIG" },
"type=file,id=aws,src=${HOME}/.aws/credentials" { type = "file", id = "aws", src = "${HOME}/.aws/credentials" },
] ]
} }
``` ```
@ -948,7 +958,7 @@ This can be useful if you need to access private repositories during a build.
```hcl ```hcl
target "default" { target "default" {
ssh = ["default"] ssh = [{ id = "default" }]
} }
``` ```