Skip to content

Commit

Permalink
Merge pull request #2953 from dvdksn/docs-bake-composable-attrs
Browse files Browse the repository at this point in the history
docs: update bake reference to use composable attrs
  • Loading branch information
crazy-max authored Jan 29, 2025
2 parents a115073 + df80bd7 commit cacb4fb
Showing 1 changed file with 30 additions and 20 deletions.
50 changes: 30 additions & 20 deletions docs/bake-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,27 +285,19 @@ The key takes a list of annotations, in the format of `KEY=VALUE`.

```hcl
target "default" {
output = ["type=image,name=foo"]
output = [{ type = "image", name = "foo" }]
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
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
example adds annotations to both the image index and manifests.

```hcl
target "default" {
output = ["type=image,name=foo"]
output = [{ type = "image", name = "foo" }]
annotations = ["index,manifest:org.opencontainers.image.authors=dvdksn"]
}
```
Expand All @@ -321,8 +313,13 @@ This attribute accepts the long-form CSV version of attestation parameters.
```hcl
target "default" {
attest = [
"type=provenance,mode=min",
"type=sbom"
{
type = "provenance",
mode = "max",
},
{
type = "sbom",
}
]
}
```
Expand All @@ -338,8 +335,15 @@ This takes a list value, so you can specify multiple cache sources.
```hcl
target "app" {
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"
}
]
}
```
Expand All @@ -355,8 +359,14 @@ This takes a list value, so you can specify multiple cache export targets.
```hcl
target "app" {
cache-to = [
"type=s3,region=eu-west-1,bucket=mybucket",
"type=inline"
{
type = "s3",
region = "eu-west-1",
bucket = "mybucket"
},
{
type = "inline",
}
]
}
```
Expand Down Expand Up @@ -863,7 +873,7 @@ The following example configures the target to use a cache-only output,

```hcl
target "default" {
output = ["type=cacheonly"]
output = [{ type = "cacheonly" }]
}
```

Expand Down Expand Up @@ -903,8 +913,8 @@ variable "HOME" {
target "default" {
secret = [
"type=env,id=KUBECONFIG",
"type=file,id=aws,src=${HOME}/.aws/credentials"
{ type = "env", id = "KUBECONFIG" },
{ type = "file", id = "aws", src = "${HOME}/.aws/credentials" },
]
}
```
Expand Down Expand Up @@ -948,7 +958,7 @@ This can be useful if you need to access private repositories during a build.

```hcl
target "default" {
ssh = ["default"]
ssh = [{ id = "default" }]
}
```

Expand Down

0 comments on commit cacb4fb

Please sign in to comment.