bake: allow BAKE_CMD_CONTEXT builtin var by tonistiigi · Pull Request #671 · docker/buildx (original) (raw)

Allows accessing the main context for bake command from bake
file that has been imported remotely.

docker buildx bake "git://github.com/docker/cli" --print

{ "target": { "binary": { "context": "git:/github.com/docker/cli", "dockerfile": "Dockerfile", "args": { "BASE_VARIANT": "alpine", "GO_STRIP": "", "VERSION": "" }, "target": "binary", "platforms": [ "local" ], "output": [ "build" ] } } }

/tmp/a # touch foo bar /tmp/a # docker buildx bake "git://github.com/tonistiigi/buildx#remote-test" ...

[4/4] RUN ls -l && stop: #9 0.207 total 0 #9 0.207 -rw-r--r-- 1 root root 0 Jul 13 03:39 bar #9 0.207 -rw-r--r-- 1 root root 0 Jul 13 03:39 foo #9 0.207 /bin/sh: stop: not found

docker buildx bake "git://github.com/tonistiigi/buildx#remote-test" "git://github.com/docker/cli"

... #8 0.232 -rw-r--r-- 1 root root 1893 Jul 13 03:58 poule.yml #8 0.232 drwxr-xr-x 7 root root 4096 Jul 13 03:58 scripts #8 0.232 drwxr-xr-x 3 root root 4096 Jul 13 03:58 service #8 0.232 drwxr-xr-x 2 root root 4096 Jul 13 03:58 templates #8 0.232 drwxr-xr-x 11 root root 4096 Jul 13 03:58 vendor #8 0.232 -rwxr-xr-x 1 root root 10123 Jul 13 03:58 vendor.conf #8 0.232 /bin/sh: stop: not found

docker buildx bake "git://github.com/tonistiigi/buildx#remote-test" "https://ftp.gnu.org/gnu/binutils/binutils-2.36.tar.gz"

...

[4/4] RUN ls -l && stop: #8 0.250 total 4 #8 0.251 drwxrwxrwx 19 root root 4096 Jul 13 04:00 binutils-2.36 #8 0.251 /bin/sh: stop: not found