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
- Run all tests on the code (for go projects this is
go fmtgo vetandgo build). -
This runs on all commits to the repository
-
Build the artifacts (in our case this is the final docker image)
-
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
-
Publish the artifacts.
- 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.