Minimal viable go install for CI builds


(Stephane Odul) #1

We use custom docker images based on the official golang:1.12 Dockerfile to run our CI jobs under k8s.

In order to optimize our CI system as much as we can, but also speed up the productivity of our remote developers that might be on a slower network we want to discard folders from /usr/local/go/ that are not absolutely required.

An obvious target is the /usr/local/go/doc directory, but we would like to delete more and we have a potential list of targets which is:
/usr/local/go/api
/usr/local/go/doc
/usr/local/go/lib
/usr/local/go/misc
/usr/local/go/test
/usr/local/go/pkg/linux_amd64
/usr/local/go/pkg/linux_amd64_race

According to https://github.com/adg/gostrip and https://groups.google.com/forum/#!searchin/golang-nuts/linux_amd64_race|sort:date/golang-nuts/HwAyVo9mBHs/uq1TpTcWqxUJ we seem to be on the right track but it is from 5 years ago and GoLang has evolved since.

Have others experimented with this recently? Currently, according to docker images our custom GoLang 1.12.9 image is 543MB vs 814MB for the official golang:1.12.9 image.