OpenAg Wiki Archive

Archived Contents from the original OpenAg Wiki (snapshot on Apr 8, 2020)

The archived wiki only includes information up the v3.0 version of the PFC-EDU, and is here for preservation purposes. You can find resources about the latest version of the PFC v4.0 on the Personal Food Computer resources page.

Docker Builder Pattern

For compiled languages, /docker/ workflow often uses the builder pattern.

What is it?

High-level:

  • Derive their Dockerfiles from an image, then, add source
  • do a build during docker build
  • create a second docker container with just binaries using a second Dockerfile
  • push it to the Docker Hub

With a statically compiled language like Golang people tended to derive their Dockerfiles from the Golang “SDK” image, add source, do a build then push it to the Docker Hub. Unfortunately the size of the resulting image was quite large - at least 670mb.

>

A workaround which is informally called the builder pattern involves using two Docker images - one to perform a build and another to ship the results of the first build without the penalty of the build-chain and tooling in the first image.

>

http://blog.alexellis.io/mutli-stage-docker-builds/

  • Advantage: build environment is bundled with binaries, making development easier
  • Disadvantage: images are larger because they include source files.
  • Workaround: 2 images. One for dev, one for deploy.

The Future

In Future, it will be possible to do multi-stage builds in Docker instead, removing the need for multiple images.

Resources