The Go Dockerfile

There are various ways to organize your Dockerfile and CI. After having tried many solutions, I have a solid way to write your Dockerfile for your Go program. The Dockerfile is also heavily optimized for the Docker layer caching mechanism, to have fast rebuilds locally and on your CI. In this post, we will analyze such Dockerfile and analyze the structure of it, which is optimized for caching, secured and designed to contain everything....

June 5, 2021 · 11 min · Quentin McGaw

Cross CPU docker images using Go

Building cross CPU Docker images for Go programs is not a trivial task. With the excellent Go compiler and the recent improvements of Docker building, quite an advanced setup can be achieved to build Docker images for all CPU architectures supported by Docker and Go. What we’ll do We will design a Dockerfile cross building a simple Go program for Docker images supporting multiple CPU architectures. The aim is to have the statically compiled Go program in a final Docker image based on the alpine:3....

June 4, 2021 · 4 min · Quentin McGaw

Cross CPU docker images with Github Actions

We will design a continous integration (CI) using Github Actions to automatically build a simple Alpine based Docker image for every CPU architecture supported by Docker. The final image will only print the machine type for this experiment using uname -m. Make sure to check out the Conclusion which highlights more posts about Docker image cross compilation with programming languages such as Go. Prerequisites Have a Github account Have a Github repository Repository setup Have this minimal file structure in your repository:...

June 4, 2021 · 4 min · Quentin McGaw