github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/docs/contributing/ctn-build.md (about)

     1  The `Dockerfile` supports building and cross compiling docker daemon and extra
     2  tools using [Docker Buildx](https://github.com/docker/buildx) and [BuildKit](https://github.com/moby/buildkit).
     3  A [bake definition](https://docs.docker.com/build/bake/file-definition/) named
     4  `docker-bake.hcl` is in place to ease the build process:
     5  
     6  ```shell
     7  # build binaries for the current host platform
     8  # output to ./bundles/binary-daemon by default
     9  docker buildx bake
    10  # or
    11  docker buildx bake binary
    12  
    13  # build binaries for the current host platform
    14  # output to ./bin
    15  DESTDIR=./bin docker buildx bake
    16  
    17  # build dynamically linked binaries
    18  # output to ./bundles/dynbinary-daemon by default
    19  DOCKER_STATIC=0 docker buildx bake
    20  # or
    21  docker buildx bake dynbinary
    22  
    23  # build binaries for all supported platforms
    24  docker buildx bake binary-cross
    25  
    26  # build binaries for a specific platform
    27  docker buildx bake --set *.platform=linux/arm64
    28  
    29  # build "complete" binaries (including containerd, runc, vpnkit, etc.)
    30  docker buildx bake all
    31  
    32  # build "complete" binaries for all supported platforms
    33  docker buildx bake all-cross
    34  
    35  # build non-runnable image wrapping "complete" binaries
    36  # useful for use with undock and sharing via a registry
    37  docker buildx bake bin-image
    38  
    39  # build non-runnable image wrapping "complete" binaries, with custom tag
    40  docker buildx bake bin-image --set "*.tags=foo/moby-bin:latest"
    41  
    42  # build non-runnable image wrapping "complete" binaries for all supported platforms
    43  # multi-platform images must be directly pushed to a registry
    44  docker buildx bake bin-image-cross --set "*.tags=foo/moby-bin:latest" --push
    45  ```