Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update bake reference to use composable attrs #2953

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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