build(bake): update overview

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson
2024-06-14 12:29:07 +02:00
parent be26b4ace6
commit 287129c8de
2 changed files with 48 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
---
title: High-level builds with Bake
title: Buildx Bake
keywords: build, buildx, bake, buildkit, hcl, json, compose
aliases:
- /build/customize/bake/
@@ -11,27 +11,47 @@ aliases:
> [feedback from users](https://github.com/docker/buildx/issues).
{ .experimental }
Buildx provides support for high-level build orchestration that goes beyond
invoking a single build command. Bake lets you build all the images in your
application together. You can define all of the build jobs for your projects in
a file that can then be easily invoked by anyone.
Bake is a feature of Docker Buildx that lets you define your build configuraton
using a declarative file, as opposed to specifying a complex CLI expression. It
also lets you run multiple builds concurrently with a single invocation.
You can think of Bake as a task runner for Docker builds.
[BuildKit](https://github.com/moby/buildkit) efficiently handles multiple
concurrent build requests and de-duplicating work. You can invoke your builds
using general-purpose task runners, like `make`. However, such tools generally
invoke builds in a sequence. Therefore they aren't leveraging the full
potential of BuildKit parallelization. Bake solves this problem.
A Bake file can be written in HCL, JSON, or YAML formats, where the YAML format
is an extension of a Docker Compose file. Here's an example Bake file in HCL
format:
The `docker buildx bake` command supports building images from a configuration
file in HCL, JSON or YAML format. The YAML format extends the Compose
Specification, and it's similar to `docker compose build`, except it builds all
of your services concurrently as part of a single request.
```hcl
group "default" {
targets = ["frontend", "backend"]
}
## Next steps
target "frontend" {
context = "./frontend"
dockerfile = "frontend.Dockerfile"
args = {
NODE_VERSION = "22"
}
tags = ["myapp/frontend:latest"]
}
- [Bake file reference](./reference.md)
- [Configuring builds](./configuring-build.md)
- [User defined HCL functions](./advanced.md)
- [Defining additional build contexts and linking targets](./build-contexts.md)
- [Building from Compose file](./compose-file.md)
target "backend" {
context = "./backend"
dockerfile = "backend.Dockerfile"
args = {
GO_VERSION = "{{% param "example_go_version" %}}"
}
tags = ["myapp/backend:latest"]
}
```
The `group` block defines a group of targets that can be built concurrently.
Each `target` block defines a build target with its own configuration, such as
the build context, Dockerfile, and tags.
To invoke a build using the above Bake file, you can run:
```console
$ docker buildx bake
```
This executes the `default` group, which builds the `frontend` and `backend`
targets concurrently.

View File

@@ -25,7 +25,7 @@
"Buildkite",
"CLI",
"CentOS-7-and-RHEL-7",
"CentOS-8-RHEL-8-and-Fedora",
"CentOS-9-stream-RHEL-8-and-Fedora",
"Circle-CI",
"Clone-with-git",
"Command-Prompt",
@@ -42,7 +42,6 @@
"Entra-ID",
"Entra-ID-SAML-2.0",
"Fedora",
"For-Mac-and-Linux",
"For-Mac-with-Apple-silicon",
"For-Mac-with-Intel-chip",
"For-all-platforms",
@@ -52,11 +51,10 @@
"GitHub-Actions",
"GitLab",
"Go",
"HCL",
"HTTP",
"Heredocs",
"Hub",
"Hyper-V-backend-and-Windows-containers",
"Hyper-V-backend-x86_64",
"Inline",
"Install-from-the-command-line",
"Install-interactively",
@@ -99,12 +97,14 @@
"Use-OpenAI",
"Using-the-CLI",
"Using-the-GUI",
"VS-Code",
"Version-4.15-4.17",
"Version-4.17-and-earlier",
"Version-4.18-and-later",
"Versions-prior-to-4.15",
"Vue",
"WSL-2-backend",
"WSL-2-backend-Arm-Beta",
"WSL-2-backend-x86_64",
"What-administrative-tasks-can-I-perform-in-Docker-Hub",
"What-are-the-key-features-of-Docker-Desktop",
"What-key-features-are-included-in-Docker-Hub",
@@ -122,8 +122,6 @@
"appearance-none",
"aspect-video",
"bake-action",
"basis-1/3",
"basis-2/3",
"bg-accent-light",
"bg-amber-light",
"bg-amber-light-200",
@@ -240,6 +238,7 @@
"gap-4",
"gap-6",
"gap-8",
"goat",
"grid",
"grid-cols-1",
"grid-cols-2",
@@ -340,7 +339,6 @@
"no-underline",
"no-wrap",
"not-prose",
"object-cover",
"openSUSE-and-SLES",
"origin-bottom-right",
"outline",
@@ -405,6 +403,7 @@
"space-x-2",
"space-y-4",
"sticky",
"svg-container",
"svg-icon",
"syntax-light",
"text-2xl",