A few months back I migrated my Docker container image hosting from my private GitLab instance over to Google Cloud Container Registry (GCR.io). It has an included build system that can be triggered by commits to GitHub (and other Git repo’s). It doesn’t do anything too complicated out of the gate, but it’s great for containers related to static sites.
The default build in GCR is a single container with a tag like the commit hash. While this default works for a lot of simple projects I wanted something slightly more complicated… a “latest” tag. Google provides additional capabilities via the
cloudbuild.yaml file. The samples they provide go deep on complexity but here’s a sample cloudbuild.yaml with your image tagged with the commit sha hash and “latest”:
The one thing to keep in mind is that the “tags” section of the yaml is NOT docker tags, it’s used by GCR. Otherwise you could use the above to build multiple images with various tags, or even two different images in the same repository.