Skip to content

CI/CD

Gitlab CI

We use Gitlab as the executor for our CI/CD pipeline - in theory any CI/CD process could work as long as it has access to docker (most do). The overall flow of the CI process is as follows

  1. Run all tests on the code (for go projects this is go fmt go vet and go build).
  2. This runs on all commits to the repository

  3. Build the artifacts (in our case this is the final docker image)

  4. This only runs on tagged builds - so to publish a release you simply tag a commit and a docker image is built off that commit

  5. Publish the artifacts.

  6. These all get pushed to our dockerhub repo using the Gitlab private secrets

Docker Images

We use multi-stage docker builds to build our projects. This lets us use a mainline image for building the artifact, while keeping the final image very lean.

All of our docker images follow the 12factor principles - docker allows us to take advantage of this by letting us tag individual commits/artifacts and promote them throughout our environments without having to recompile.

This means that for promotion of a service through our environments all we need to do is simply bump the version number in our repositories.