You are browsing a read-only backup copy of Wikitech. The live site can be found at


From Wikitech-static
Revision as of 21:05, 11 December 2017 by imported>Thcipriani (make example section)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Blubber Logo.png

Blubber is a highly opinionated abstraction for container build configurations and a command-line compiler which currently supports outputting multi-stage Dockerfiles. It aims to provide a handful of declarative constructs that accomplish build configuration in a more secure and determinate way than running ad-hoc commands.



Blubber requires

  • Go 1.7+ (for the context package and vendored dependencies)
  • git
  • docker 17.06+ (for multistage build support)
$ export GOPATH="$HOME/go"
$ go get

This will install blubber to ~/go/bin/blubber


Blubber takes opinionated input files in yaml format and outputs a variant of a Dockerfiles that should be safe to run for their intended purpose. The number of potential variants in a Blubber config are not limited. Variants can inherit instructions, packages, and runtime environments from one another using the includes directive.

Below is an example blubber.yaml for Mathoid

apt: { packages: [librsvg2-2] }
  in: /srv/service
  as: runuser
  uid: 666
  gid: 666
  environment: { APP_BASE_PATH: /srv/service }

    apt: { packages: [librsvg2-dev, git, pkg-config, build-essential] }
    node: { dependencies: true }
    runs: { environment: { LINK: g++ } }
    includes: [build]
    entrypoint: [node, server.js]
    includes: [build]
    entrypoint: [npm, test]
    includes: [build]
    node: { env: production }
    copies: prep
    node: { env: production }
    entrypoint: [node, server.js]

Example usage

In order to output a Dockerfile, Blubber needs a configuration file and a variant that you want to output. The available variants in the file above are build, development, test, prep, and production. To run current tests in a test build using blubber pass the test variant to Docker to build and run. For example in the Mathoid repository, the Blubber configuration file lives under the path dist/pipeline/blubber.yaml:

$ cd ~/src/mathoid
$ blubber dist/pipeline/blubber.yaml test | docker build -t mathoid-test-$(date --iso) -f - .
$ docker run --rm -it mathoid-test-$(date --iso)
$ docker rmi mathoid-test-$(date --iso)