mirror of https://github.com/docker/docs.git
bake: document target interpolation
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
parent
178a56fd1c
commit
e7a93fa64f
|
@ -93,6 +93,55 @@ $ docker buildx bake -f docker-bake.hcl -f env.hcl --print app
|
|||
}
|
||||
```
|
||||
|
||||
You can also refer to attributes defined as part of other targets, to help
|
||||
reduce duplication between targets.
|
||||
|
||||
```hcl
|
||||
# docker-bake.hcl
|
||||
target "foo" {
|
||||
dockerfile = "${target.foo.name}.Dockerfile"
|
||||
tags = [target.foo.name]
|
||||
}
|
||||
target "bar" {
|
||||
dockerfile = "${target.foo.name}.Dockerfile"
|
||||
tags = [target.bar.name]
|
||||
}
|
||||
```
|
||||
|
||||
You can use this file directly:
|
||||
|
||||
```console
|
||||
$ docker buildx bake --print foo bar
|
||||
```
|
||||
```json
|
||||
{
|
||||
"group": {
|
||||
"default": {
|
||||
"targets": [
|
||||
"foo",
|
||||
"bar"
|
||||
]
|
||||
}
|
||||
},
|
||||
"target": {
|
||||
"foo": {
|
||||
"context": ".",
|
||||
"dockerfile": "foo.Dockerfile",
|
||||
"tags": [
|
||||
"foo"
|
||||
]
|
||||
},
|
||||
"bar": {
|
||||
"context": ".",
|
||||
"dockerfile": "foo.Dockerfile",
|
||||
"tags": [
|
||||
"bar"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## From command line
|
||||
|
||||
You can also override target configurations from the command line with the
|
||||
|
|
Loading…
Reference in New Issue