mirror of https://github.com/docker/docs.git
Merge pull request #17186 from dvdksn/build/migrate-bake-reference
build: move bake reference to buildx repo
This commit is contained in:
commit
7079dc4572
|
@ -269,3 +269,11 @@ fetch-remote:
|
||||||
- dest: "compose/compose-file/deploy.md"
|
- dest: "compose/compose-file/deploy.md"
|
||||||
src:
|
src:
|
||||||
- "deploy.md"
|
- "deploy.md"
|
||||||
|
|
||||||
|
- repo: "https://github.com/docker/buildx"
|
||||||
|
default_branch: "master"
|
||||||
|
ref: "v0.10"
|
||||||
|
paths:
|
||||||
|
- dest: "build/bake/reference.md"
|
||||||
|
src:
|
||||||
|
- "docs/bake-reference.md"
|
||||||
|
|
|
@ -186,8 +186,8 @@ examples: |-
|
||||||
$ docker buildx bake -f docker-bake.dev.hcl db webapp-release
|
$ docker buildx bake -f docker-bake.dev.hcl db webapp-release
|
||||||
```
|
```
|
||||||
|
|
||||||
See our [file definition](/build/bake/file-definition/)
|
See the [Bake file reference](/build/bake/reference/)
|
||||||
guide for more details.
|
for more details.
|
||||||
|
|
||||||
### Do not use cache when building the image (--no-cache) {#no-cache}
|
### Do not use cache when building the image (--no-cache) {#no-cache}
|
||||||
|
|
||||||
|
|
|
@ -1688,8 +1688,8 @@ manuals:
|
||||||
section:
|
section:
|
||||||
- path: /build/bake/
|
- path: /build/bake/
|
||||||
title: Overview
|
title: Overview
|
||||||
- path: /build/bake/file-definition/
|
- path: /build/bake/reference/
|
||||||
title: File definition
|
title: Bake file reference
|
||||||
- path: /build/bake/configuring-build/
|
- path: /build/bake/configuring-build/
|
||||||
title: Configuring builds
|
title: Configuring builds
|
||||||
- path: /build/bake/hcl-funcs/
|
- path: /build/bake/hcl-funcs/
|
||||||
|
@ -1698,6 +1698,8 @@ manuals:
|
||||||
title: Build contexts and linking targets
|
title: Build contexts and linking targets
|
||||||
- path: /build/bake/compose-file/
|
- path: /build/bake/compose-file/
|
||||||
title: Building from Compose file
|
title: Building from Compose file
|
||||||
|
- path: /build/bake/remote-definition/
|
||||||
|
title: Remote Bake file definition
|
||||||
- sectiontitle: Attestations
|
- sectiontitle: Attestations
|
||||||
section:
|
section:
|
||||||
- path: /build/attestations/
|
- path: /build/attestations/
|
||||||
|
|
|
@ -8,7 +8,7 @@ redirect_from:
|
||||||
## Specification
|
## Specification
|
||||||
|
|
||||||
Bake uses the [compose-spec](../../compose/compose-file/index.md) to
|
Bake uses the [compose-spec](../../compose/compose-file/index.md) to
|
||||||
parse a compose file and translate each service to a [target](file-definition.md#target).
|
parse a compose file and translate each service to a [target](reference.md#target).
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# docker-compose.yml
|
# docker-compose.yml
|
||||||
|
@ -94,8 +94,7 @@ $ docker buildx bake --print
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Unlike the [HCL format](file-definition.md#hcl-definition), there are some
|
The compose format has some limitations compared to the HCL format:
|
||||||
limitations with the compose format:
|
|
||||||
|
|
||||||
* Specifying variables or global scope attributes is not yet supported
|
* Specifying variables or global scope attributes is not yet supported
|
||||||
* `inherits` service field is not supported, but you can use [YAML anchors](../../compose/compose-file/10-fragments.md){:target="blank" rel="noopener" class=""}
|
* `inherits` service field is not supported, but you can use [YAML anchors](../../compose/compose-file/10-fragments.md){:target="blank" rel="noopener" class=""}
|
||||||
|
|
|
@ -7,7 +7,7 @@ redirect_from:
|
||||||
|
|
||||||
## Using interpolation to tag an image with the git sha
|
## Using interpolation to tag an image with the git sha
|
||||||
|
|
||||||
As shown in the [File definition](file-definition.md#variable) page, `bake`
|
As shown in the [Bake file reference](reference.md#variable) page, `bake`
|
||||||
supports variable blocks which are assigned to matching environment variables
|
supports variable blocks which are assigned to matching environment variables
|
||||||
or default values:
|
or default values:
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ and also allows better code reuse, different target groups and extended features
|
||||||
|
|
||||||
## Next steps
|
## Next steps
|
||||||
|
|
||||||
* [File definition](file-definition.md)
|
* [Bake file reference](reference.md)
|
||||||
* [Configuring builds](configuring-build.md)
|
* [Configuring builds](configuring-build.md)
|
||||||
* [User defined HCL functions](hcl-funcs.md)
|
* [User defined HCL functions](hcl-funcs.md)
|
||||||
* [Defining additional build contexts and linking targets](build-contexts.md)
|
* [Defining additional build contexts and linking targets](build-contexts.md)
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
title: Buildx Bake reference
|
||||||
|
description: Learn about the syntax and available commands for the Buildx Bake file
|
||||||
|
keywords: build, reference, buildx, bake, hcl
|
||||||
|
fetch_remote:
|
||||||
|
line_start: 2
|
||||||
|
line_end: -1
|
||||||
|
---
|
|
@ -0,0 +1,136 @@
|
||||||
|
---
|
||||||
|
title: Remote Bake file definition
|
||||||
|
keywords: build, buildx, bake, file, remote
|
||||||
|
---
|
||||||
|
|
||||||
|
You can also build Bake files directly from a remote Git repository or HTTPS URL:
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ docker buildx bake "https://github.com/docker/cli.git#v20.10.11" --print
|
||||||
|
#1 [internal] load git source https://github.com/docker/cli.git#v20.10.11
|
||||||
|
#1 0.745 e8f1871b077b64bcb4a13334b7146492773769f7 refs/tags/v20.10.11
|
||||||
|
#1 2.022 From https://github.com/docker/cli
|
||||||
|
#1 2.022 * [new tag] v20.10.11 -> v20.10.11
|
||||||
|
#1 DONE 2.9s
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"group": {
|
||||||
|
"default": {
|
||||||
|
"targets": [
|
||||||
|
"binary"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"target": {
|
||||||
|
"binary": {
|
||||||
|
"context": "https://github.com/docker/cli.git#v20.10.11",
|
||||||
|
"dockerfile": "Dockerfile",
|
||||||
|
"args": {
|
||||||
|
"BASE_VARIANT": "alpine",
|
||||||
|
"GO_STRIP": "",
|
||||||
|
"VERSION": ""
|
||||||
|
},
|
||||||
|
"target": "binary",
|
||||||
|
"platforms": [
|
||||||
|
"local"
|
||||||
|
],
|
||||||
|
"output": [
|
||||||
|
"build"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
As you can see the context is fixed to `https://github.com/docker/cli.git` even if
|
||||||
|
[no context is actually defined](https://github.com/docker/cli/blob/2776a6d694f988c0c1df61cad4bfac0f54e481c8/docker-bake.hcl#L17-L26){:target="blank" rel="noopener" class=""}
|
||||||
|
in the definition.
|
||||||
|
|
||||||
|
If you want to access the main context for bake command from a bake file
|
||||||
|
that has been imported remotely, you can use the [`BAKE_CMD_CONTEXT` built-in var](reference.md#built-in-variables).
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ cat https://raw.githubusercontent.com/tonistiigi/buildx/remote-test/docker-bake.hcl
|
||||||
|
```
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
target "default" {
|
||||||
|
context = BAKE_CMD_CONTEXT
|
||||||
|
dockerfile-inline = <<EOT
|
||||||
|
FROM alpine
|
||||||
|
WORKDIR /src
|
||||||
|
COPY . .
|
||||||
|
RUN ls -l && stop
|
||||||
|
EOT
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ docker buildx bake "https://github.com/tonistiigi/buildx.git#remote-test" --print
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"target": {
|
||||||
|
"default": {
|
||||||
|
"context": ".",
|
||||||
|
"dockerfile": "Dockerfile",
|
||||||
|
"dockerfile-inline": "FROM alpine\nWORKDIR /src\nCOPY . .\nRUN ls -l \u0026\u0026 stop\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ touch foo bar
|
||||||
|
$ docker buildx bake "https://github.com/tonistiigi/buildx.git#remote-test"
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
...
|
||||||
|
> [4/4] RUN ls -l && stop:
|
||||||
|
#8 0.101 total 0
|
||||||
|
#8 0.102 -rw-r--r-- 1 root root 0 Jul 27 18:47 bar
|
||||||
|
#8 0.102 -rw-r--r-- 1 root root 0 Jul 27 18:47 foo
|
||||||
|
#8 0.102 /bin/sh: stop: not found
|
||||||
|
```
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ docker buildx bake "https://github.com/tonistiigi/buildx.git#remote-test" "https://github.com/docker/cli.git#v20.10.11" --print
|
||||||
|
#1 [internal] load git source https://github.com/tonistiigi/buildx.git#remote-test
|
||||||
|
#1 0.429 577303add004dd7efeb13434d69ea030d35f7888 refs/heads/remote-test
|
||||||
|
#1 CACHED
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"target": {
|
||||||
|
"default": {
|
||||||
|
"context": "https://github.com/docker/cli.git#v20.10.11",
|
||||||
|
"dockerfile": "Dockerfile",
|
||||||
|
"dockerfile-inline": "FROM alpine\nWORKDIR /src\nCOPY . .\nRUN ls -l \u0026\u0026 stop\n"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ docker buildx bake "https://github.com/tonistiigi/buildx.git#remote-test" "https://github.com/docker/cli.git#v20.10.11"
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
...
|
||||||
|
> [4/4] RUN ls -l && stop:
|
||||||
|
#8 0.136 drwxrwxrwx 5 root root 4096 Jul 27 18:31 kubernetes
|
||||||
|
#8 0.136 drwxrwxrwx 3 root root 4096 Jul 27 18:31 man
|
||||||
|
#8 0.136 drwxrwxrwx 2 root root 4096 Jul 27 18:31 opts
|
||||||
|
#8 0.136 -rw-rw-rw- 1 root root 1893 Jul 27 18:31 poule.yml
|
||||||
|
#8 0.136 drwxrwxrwx 7 root root 4096 Jul 27 18:31 scripts
|
||||||
|
#8 0.136 drwxrwxrwx 3 root root 4096 Jul 27 18:31 service
|
||||||
|
#8 0.136 drwxrwxrwx 2 root root 4096 Jul 27 18:31 templates
|
||||||
|
#8 0.136 drwxrwxrwx 10 root root 4096 Jul 27 18:31 vendor
|
||||||
|
#8 0.136 -rwxrwxrwx 1 root root 9620 Jul 27 18:31 vendor.conf
|
||||||
|
#8 0.136 /bin/sh: stop: not found
|
||||||
|
```
|
|
@ -101,7 +101,7 @@ fixes in [Docker Buildx](https://github.com/docker/buildx){:target="blank" rel="
|
||||||
support in BuildKit v0.11.0+. {% include github_issue.md repo="docker/buildx" number="1482" %}
|
support in BuildKit v0.11.0+. {% include github_issue.md repo="docker/buildx" number="1482" %}
|
||||||
* Buildx now remembers the last activity for a builder for better organization
|
* Buildx now remembers the last activity for a builder for better organization
|
||||||
of builder instances. {% include github_issue.md repo="docker/buildx" number="1439" %}
|
of builder instances. {% include github_issue.md repo="docker/buildx" number="1439" %}
|
||||||
* Bake definition now supports [null values](bake/file-definition.md#null-values)
|
* Bake definition now supports null values for [variables](bake/reference.md#variable) and [labels](bake/reference.md#targetlabels)
|
||||||
for build arguments and labels to use the defaults set in the Dockerfile {% include github_issue.md repo="docker/buildx" number="1449" %}
|
for build arguments and labels to use the defaults set in the Dockerfile {% include github_issue.md repo="docker/buildx" number="1449" %}
|
||||||
* The [`buildx imagetools inspect` command](../engine/reference/commandline/buildx_imagetools_inspect.md)
|
* The [`buildx imagetools inspect` command](../engine/reference/commandline/buildx_imagetools_inspect.md)
|
||||||
now supports showing SBOM and Provenance data {% include github_issue.md repo="docker/buildx" number="1444" %}
|
now supports showing SBOM and Provenance data {% include github_issue.md repo="docker/buildx" number="1444" %}
|
||||||
|
|
Loading…
Reference in New Issue