BuildKit Reference
Clipper has a BuildKit build driver with several advantages over the default driver. For a quick setup guide with GHA, see CI/CD Integration.
Driver image: clipperregistry/buildkit:latest.
Local
Create the Clipper driver, set as default.
docker buildx create --driver-opt image=clipperregistry/buildkit:latest --use
or create the driver, use on demand
docker buildx create --driver-opt image=clipperregistry/buildkit:latest --name clipper
docker buildx build --driver clipper ...
GHA
- uses: docker/setup-buildx-action@v4
with:
driver-opts: image=clipperregistry/buildkit:latest
Clipper Export
Required for build output to clipper.dev
A docker buildx build --output type that writes the build result in Clipper’s format.
| Option | Type | Default | Description |
|---|---|---|---|
name | string | required | Target reference, e.g. clipper.dev/myorg/myapp:1.0. |
push | bool | true | Push to the registry. When false, the result stays in the local content store. |
Example
--output type=clipper,name=clipper.dev/myorg/myapp:1.0
Cache Export
Automatic, using the Clipper build driver, cache mount will be exported in Clipper’s format.
Cache Mount Export
Allows for pushing/pulling RUN --mount=type=cache directories to Clipper.
A value for the mode attribute on --cache-to / --cache-from. This is independent of the layer cache, use a separate cache ref for each (eg cache and cache-mounts).
Cache mounts always use lazy pulling, to allow building a large cache without wasting time pulling unused files.
Supported on all standard cache backends:
| Backend | --cache-to | --cache-from |
|---|---|---|
registry | type=registry,ref=<ref>,mode=cache-mount | type=registry,ref=<ref>,mode=cache-mount |
gha | type=gha,scope=<scope>,mode=cache-mount,repository=<repo>,ghtoken=<token> | type=gha,scope=<scope>,mode=cache-mount |
local | type=local,dest=<path>,mode=cache-mount | type=local,src=<path>,mode=cache-mount |
Example
docker buildx build \
--output type=clipper,name=clipper.dev/myorg/myapp:1.0 \
--cache-to type=registry,ref=clipper.dev/myorg/myapp-cache:main,mode=max \
--cache-from type=registry,ref=clipper.dev/myorg/myapp-cache:main \
--cache-to type=registry,ref=clipper.dev/myorg/myapp-cache:main-mounts,mode=cache-mount \
--cache-from type=registry,ref=clipper.dev/myorg/myapp-cache:main-mounts,mode=cache-mount \
.
Lazy pulls: the clipper-lazy snapshotter
An OCI worker snapshotter that serves files from Clipper base images (FROM clipper.dev/...) and cached layers on demand instead of downloading and extracting every layer before the build starts. Only the files a build step actually reads are fetched, which can speed up pulls on large images. Linux only.
While lazy pulling is generally faster, your mileage may vary - profile after enabling.
Enable it in the buildkitd config:
[worker.oci]
snapshotter = "clipper-lazy"
With setup-buildx-action, pass that config inline:
- uses: docker/setup-buildx-action@v4
with:
driver-opts: image=clipperregistry/buildkit:latest
buildkitd-config-inline: |
[worker.oci]
snapshotter = "clipper-lazy"