concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit
 
 
 
Go to file
Tonis Tiigi 45bfdd5e42 exporter: add image exporter
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-07-10 23:29:14 -07:00
api/services/control exporter: add image exporter 2017-07-10 23:29:14 -07:00
cache exporter: add image exporter 2017-07-10 23:29:14 -07:00
client exporter: add image exporter 2017-07-10 23:29:14 -07:00
cmd exporter: add image exporter 2017-07-10 23:29:14 -07:00
control exporter: add image exporter 2017-07-10 23:29:14 -07:00
examples examples: add back older versions of buildkit 2017-07-10 22:33:34 -07:00
exporter exporter: add image exporter 2017-07-10 23:29:14 -07:00
hack vendor: update containerd 2017-07-10 23:29:09 -07:00
identity identity: add pkg for random id generation 2017-06-19 14:32:50 -07:00
snapshot make blobmapping use metadata package 2017-07-04 21:55:27 -07:00
solver exporter: add image exporter 2017-07-10 23:29:14 -07:00
source source: add keepgitdir option for git source 2017-07-10 22:19:05 -07:00
util source: add git source 2017-07-10 22:19:05 -07:00
vendor vendor: update containerd 2017-07-10 23:29:09 -07:00
worker source: add git source 2017-07-10 22:19:05 -07:00
.dockerignore .gitignore and .dockerignore: add .buildstate 2017-06-30 06:24:19 +00:00
.gitignore .gitignore and .dockerignore: add .buildstate 2017-06-30 06:24:19 +00:00
.travis.yml add hack/validate-vendor 2017-06-13 08:47:41 +00:00
LICENSE Add license 2017-06-01 09:58:33 -07:00
Makefile project: remove poc label 2017-06-23 09:37:36 -07:00
README.md vendor: update containerd 2017-07-10 23:29:09 -07:00
gometalinter.json exporter: add image exporter 2017-07-10 23:29:14 -07:00
vendor.conf vendor: update containerd 2017-07-10 23:29:09 -07:00

README.md

Important: This repository is in an early development phase and not suitable for practical workloads. It does not compare with docker build features yet.

asciicinema example

BuildKit

BuildKit is a toolkit for converting source code to build artifacts in an efficient, expressive and repeatable manner.

Key features:

  • Automatic garbage collection
  • Extendable frontend formats
  • Concurrent dependency resolution
  • Efficient instruction caching
  • Build cache import/export
  • Nested build job invocations
  • Distributable workers
  • Multiple output formats
  • Pluggable architecture

Read the proposal from https://github.com/moby/moby/issues/32925

Quick start

BuildKit daemon can be built in two different versions: one that uses containerd for execution and distribution, and a standalone version that doesn't have other dependencies apart from runc. We are open for adding more backends. buildd is a CLI utility for running the gRPC API.

# buildd daemon (choose one)
go build -o buildd-containerd -tags containerd ./cmd/buildd
go build -o buildd-standalone -tags standalone ./cmd/buildd

# buildctl utility
go build -o buildctl ./cmd/buildctl

You can also use make binaries that prepares all binaries into the bin/ directory.

The first thing to test could be to try building BuildKit with BuildKit. BuildKit provides a low-level solver format that could be used by multiple build definitions. Preparation work for making the Dockerfile parser reusable as a frontend is tracked in https://github.com/moby/moby/pull/33492. As no frontends have been integrated yet we currently have to use a client library to generate this low-level definition.

examples/buildkit* directory contains scripts that define how to build different configurations of BuildKit and its dependencies using the client package. Running one of these script 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 this definition.

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

To start building use buildctl build command. The script accepts --target flag to choose between containerd and standalone configurations. In standalone mode BuildKit binaries are built together with runc. In containerd mode, the containerd binary is built as well from the upstream repo.

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

buildctl build will show interactive progress bar by default while the build job is running. It will also show you the path to the trace file that contains 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.

  • ./examples/buildkit0 - uses only exec operations, defines a full stage per component.
  • ./examples/buildkit1 - cloning git repositories has been separated for extra concurrency.
  • ./examples/buildkit2 - uses git sources directly instead of running git clone, allowing better performance and much safer caching.

Supported runc version

During development buildkit is tested with the version of runc that is being used by the containerd repository. Please refer to runc.md for more information.

Contributing

Running tests:

make test

Updating vendored dependencies:

# update vendor.conf
make vendor

Validating your updates before submission:

make validate-all