buildkit/examples
Tonis Tiigi e0124e192c llb: add constraints to async llb
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-06-22 21:34:43 -07:00
..
build-using-dockerfile massive doc updates 2019-10-16 18:55:27 +09:00
buildctl-daemonless buildctl-daemonless.sh: show log on "could not connect to ..." 2020-07-24 16:14:59 +09:00
buildkit0 update to go 1.16 2021-06-02 00:31:57 +02:00
buildkit1 llb: add constraints to async llb 2021-06-22 21:34:43 -07:00
buildkit2 update to go 1.16 2021-06-02 00:31:57 +02:00
buildkit3 update to go 1.16 2021-06-02 00:31:57 +02:00
dockerfile2llb llb: asyncronous llb graph generation support 2020-04-03 14:55:10 -07:00
gobuild update containerd daemon to 1.2.7 and old to 1.1.7 2019-08-20 17:02:43 -07:00
kubernetes Add lint 2020-11-22 18:11:05 +01:00
nested-llb update to go 1.16 2021-06-02 00:31:57 +02:00
systemd Add support for fd:// for socket activation 2020-12-30 16:57:23 +01:00
README.md massive doc updates 2019-10-16 18:55:27 +09:00
kube-consistent-hash massive doc updates 2019-10-16 18:55:27 +09:00

README.md

BuildKit Examples

Kubernetes manifests

  • ./kubernetes: Kubernetes manifests (Pod, Deployment, StatefulSet, Job)

CLI examples

LLB examples

For understanding the basics of LLB, buildkit* directory contains scripts that define how to build different configurations of BuildKit itself and its dependencies using the client package. Running one of these scripts generates a protobuf definition of a build graph. Note that the script itself does not execute any steps of the build.

You can use buildctl debug dump-llb to see what data is in this definition. Add --dot to generate dot layout.

go run examples/buildkit0/buildkit.go \
    | buildctl debug dump-llb \
    | jq .

To start building use buildctl build command. The example script accepts --with-containerd flag to choose if containerd binaries and support should be included in the end result as well.

go run examples/buildkit0/buildkit.go \
    | buildctl build

buildctl build will show interactive progress bar by default while the build job is running. If the path to the trace file is specified, the trace file generated will contain all information about the timing of the individual steps and logs.

Different versions of the example scripts show different ways of describing the build definition for this project to show the capabilities of the library. New versions have been added when new features have become available.

  • ./buildkit0 - uses only exec operations, defines a full stage per component.
  • ./buildkit1 - cloning git repositories has been separated for extra concurrency.
  • ./buildkit2 - uses git sources directly instead of running git clone, allowing better performance and much safer caching.
  • ./buildkit3 - allows using local source files for separate components eg. ./buildkit3 --runc=local | buildctl build --local runc-src=some/local/path
  • ./dockerfile2llb - can be used to convert a Dockerfile to LLB for debugging purposes
  • ./nested-llb - shows how to use nested invocation to generate LLB
  • ./gobuild - shows how to use nested invocation to generate LLB for Go package internal dependencies