Build script that generates Ubuntu golang build containers for both local and remote registries with multi-arch build options. A single Dockerfile based on the docker-library repositories: buildpack-deps, and golang is used with docker build args.
PLEASE NOTE: To reduce attack surface in a production environment, these containers should only be used during multi-stage builds as the build container, with run-time containers generated from official builds.
Clone the repository in ${HOME}/containers
:
$ cd ${HOME}/containers
$ git clone https://github.com/rpinz/golang.git
Build containers locally
$ cd ${HOME}/containers/golang
$ ./build.sh local
Build containers and push to registry
$ cd ${HOME}/containers/golang
$ ./build.sh build
Build multi-arch containers and push to registry
$ cd ${HOME}/containers/golang
$ ./build.sh buildx
TODO:
- Create Ubuntu Dockerfile based on docker-library
- Add golang installation to Dockerfile
- Create build script to generate golang build containers
- Add buildx multi-arch support to build script
- Optimize installed packages to only those needed by typical golang usage