Nothing Special   »   [go: up one dir, main page]

{ const container = $el; // The div with overflow const item = document.getElementById('sidebar-current-page') if (item) { const containerTop = container.scrollTop; const containerBottom = containerTop + container.clientHeight; const itemTop = item.offsetTop - container.offsetTop; const itemBottom = itemTop + item.offsetHeight; // Scroll only if the item is out of view if (itemBottom > containerBottom - 200) { container.scrollTop = itemTop - (container.clientHeight / 2 - item.offsetHeight / 2); } } })" class="md:h-[calc(100vh-64px)] fixed md:sticky top-0 md:top-16 z-40 hidden h-screen flex-none overflow-y-auto overflow-x-hidden bg-background-light dark:bg-gray-dark-100 w-full md:z-auto md:block md:w-[300px]" :class="{ 'hidden': ! $store.showSidebar }">

Bake targets

A target in a Bake file represents a build invocation. It holds all the information you would normally pass to a docker build command using flags.

target "webapp" {
  dockerfile = "webapp.Dockerfile"
  tags = ["docker.io/username/webapp:latest"]
  context = "https://github.com/username/webapp"
}

To build a target with Bake, pass name of the target to the bake command.

$ docker buildx bake webapp

You can build multiple targets at once by passing multiple target names to the bake command.

$ docker buildx bake webapp api tests

Default target

If you don't specify a target when running docker buildx bake, Bake will build the target named default.

target "default" {
  dockerfile = "webapp.Dockerfile"
  tags = ["docker.io/username/webapp:latest"]
  context = "https://github.com/username/webapp"
}

To build this target, run docker buildx bake without any arguments:

$ docker buildx bake

Target properties

The properties you can set for a target closely resemble the CLI flags for docker build, with a few additional properties that are specific to Bake.

For all the properties you can set for a target, see the Bake reference.

Grouping targets

You can group targets together using the group block. This is useful when you want to build multiple targets at once.

group "all" {
  targets = ["webapp", "api", "tests"]
}

target "webapp" {
  dockerfile = "webapp.Dockerfile"
  tags = ["docker.io/username/webapp:latest"]
  context = "https://github.com/username/webapp"
}

target "api" {
  dockerfile = "api.Dockerfile"
  tags = ["docker.io/username/api:latest"]
  context = "https://github.com/username/api"
}

target "tests" {
  dockerfile = "tests.Dockerfile"
  contexts = {
    webapp = "target:webapp",
    api = "target:api",
  }
  output = ["type=local,dest=build/tests"]
  context = "."
}

To build all the targets in a group, pass the name of the group to the bake command.

$ docker buildx bake all

Additional resources

Refer to the following pages to learn more about Bake's features:

  • Learn how to use variables in Bake to make your build configuration more flexible.
  • Learn how you can use matrices to build multiple images with different configurations in Matrices.
  • Head to the Bake file reference to learn about all the properties you can set in a Bake file, and its syntax.