1. 8
  1. 2

    I am working on a couple of Go applications that I package with docker.

    I usually have a matrix of build parameters which includes at least the deploy target environment.

    The dev and the production builds have different properties, former includes error backtraces for dev, the later strips the binary and packs some assets.

    One of the applications has also different targets for the storage it uses: sqlite vs postgres vs boltdb, vs all of them configurable at runtime. Finally I have the information about the version itself, a git sha, a tag if it exists and a branch name.

    Putting it all together it results in something like:

    • v0.1.1-dev-postgres - tagged dev version with postgresql backend
    • dev-sqlite - latest development image with sqlite as a backend, regardless of branch
    • master-dev-all - tip of master branch for dev environment with all backends compiled in
    • master-175104c-prod-boltdb - specific commit from the master branch (usually corresponding to a push or merge)

    Luckily all the images are not very large (the largest ones *dev-all are about 30MB) otherwise it would make hosting them a bit of a chore.

    1. 2

      I set a bunch of labels from the org.opencontainers spec https://github.com/opencontainers/image-spec/blob/main/annotations.md