mirror of https://github.com/docker/docs.git
Merge pull request #18711 from crazy-max/bake-local-remote
build(bake): specify local and remote bake definitions
This commit is contained in:
commit
112cf4a120
|
@ -129,3 +129,53 @@ $ docker buildx bake "https://github.com/tonistiigi/buildx.git#remote-test" "htt
|
||||||
#8 0.136 -rwxrwxrwx 1 root root 9620 Jul 27 18:31 vendor.conf
|
#8 0.136 -rwxrwxrwx 1 root root 9620 Jul 27 18:31 vendor.conf
|
||||||
#8 0.136 /bin/sh: stop: not found
|
#8 0.136 /bin/sh: stop: not found
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Remote definition with the --file flag
|
||||||
|
|
||||||
|
You can also specify the Bake definition to load from the remote repository,
|
||||||
|
using the `--file` or `-f` flag:
|
||||||
|
|
||||||
|
```console
|
||||||
|
docker buildx bake -f bake.hcl "https://github.com/crazy-max/buildx.git#remote-with-local"
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
...
|
||||||
|
#4 [2/2] RUN echo "hello world"
|
||||||
|
#4 0.270 hello world
|
||||||
|
#4 DONE 0.3s
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to use a combination of local and remote definitions, you can
|
||||||
|
specify a local definition using the `cwd://` prefix with `-f`:
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
# local.hcl
|
||||||
|
target "default" {
|
||||||
|
args = {
|
||||||
|
HELLO = "foo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```console
|
||||||
|
docker buildx bake -f bake.hcl -f cwd://local.hcl "https://github.com/crazy-max/buildx.git#remote-with-local" --print
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"target": {
|
||||||
|
"default": {
|
||||||
|
"context": "https://github.com/crazy-max/buildx.git#remote-with-local",
|
||||||
|
"dockerfile": "Dockerfile",
|
||||||
|
"args": {
|
||||||
|
"HELLO": "foo"
|
||||||
|
},
|
||||||
|
"target": "build",
|
||||||
|
"output": [
|
||||||
|
"type=cacheonly"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue