From Wikitech
Jump to navigation Jump to search

Blubber as a BuildKit frontend

Blubber is now implemented as a BuildKit frontend that can be used directly with docker build, docker buildx or buildctl.

Using Blubber with docker build or docker buildx

To build an image from your blubber.yaml using Docker build tools, simply add the correct syntax directive at the top of the file that references the image name and version that you're using. Be sure to check for the latest version/tag on to ensure compatibility with WMF CI as we'll likely be using the latest release.

version: v4
      in: /src
     - custom:
         requirements: [Makefile, src/]
         command: [make]
      - from: build
        source: /src/my-program
        destination: ./
    entrypoint: [./my-program]

That's it. Now your blubber.yaml can be used directly with Docker build tools!

$ docker build --target test -f blubber.yaml .
$ docker buildx build --target test -f blubber.yaml --platform=linux/amd64,linux/arm64 .

Using Blubber with buildctl

Note that buildctl requires a running instance of buildkitd, so we recommend using Docker tools for most development use cases. However, buildctl is what we use in CI, so the closest thing to that locally would be the following.

docker run -d --name buildkitd --privileged
export BUILDKIT_HOST=docker-container://buildkitd
buildctl build --frontend=gateway.v0 \
  --opt \
  --local context=. \
  --local dockerfile=. \
  --opt filename=blubber.yaml \
  --opt target=test

CLI binary

Using Go tools

go install

(Be sure that $GOPATH/bin is in your PATH. If the environment variable is unset, the default is returned by go env GOPATH.)

Installing from source

See in the Blubber repo.

Further reading


Now that you have Blubber installed, try your hand at one of the tutorials.