November 5, 2018

The Go 1.11 web service Dockerfile

Build with Modules, Ship from Scratch If you use dep, check out this post instead. Goals: The application executable is compiled inside a container, in order to boost reproducibility The resulting image must be as small as possible The application must run in a container as secure as possible: an unprivileged user in a minimal environment The application must be able to make HTTPS calls It is a multistage Dockerfile: the first throwaway stage is used for building, while the final image will only contain the compiled binary executable. Read more

February 14, 2018

The Go Dockerfile

Build With Dep, Ship From Scratch For Go 1.11 modules, check this post instead. In a devops environment, pushing some code to the repository is not enough. You have to ship it. And the first step is often writing a Dockerfile. The goals: The code has to be compiled in a container, to boost the chances my build will be reproducible. Use dep for fetching the dependencies in case the vendor folder is not committed alongside with the code. Read more