Godo ("Go do") is a build tool for executing consistent, reproducible builds inside Docker containers.
The only dependencies to use godo are a working Docker installation and the godo
binary installed.
Over the last year, there have been a few posts explaining how to build Go code using Docker containers. The key features of this workflow are as follows:
- You don't need Go installed on your machine
- You can compile with any version of Go, without changing your host's setup
- You can move your build environment anywhere, as long as you have Docker
I started writing a tool to make it dead-simple to compile Go programs with this method, but quickly realized that Docker containers can be used to provide consistent and portable builds, everywhere Docker is installed.
In addition to creating a tool to make the Docker-based workflow dead-simple, I also created a yaml-based file format that tells the godo
CLI what builds it can run.
Godo loosely resembles make
, except the commands and scripts that you tell it to execute must be inside a Docker conainer.
Like make
, it operates on build targets and ships with the following targets pre-configured, out of the box:
build
- build your Go code inside a container (soon to be deprecated, in favor of a custom target)docker-build
- build an image with your Go program inside itdocker-push
- push your image to a Docker repositorycustom
- execute an arbitrary script inside a Docker container
Project structures and settings vary significantly, so each of those targets are configurable in a godo.yaml
file (or godo.yml
). See Godo's own godo.yaml file for an example
Writing code for Godo is simple. Since it's a build tool, it can bootstrap itself by running godo build
in the root of the repo.
Assuming you don't have a godo
binary available, you can build it with the standard go
toolchain as well. Here's what you'll need:
- Go 1.6+
- Glide 0.8+
Once you ensure that you have both dependencies, simply:
glide install
go install
Ensure that you have $GOPATH/bin
somewhere on your $PATH
, and now you can execute godo
targets.
When you're ready to write code, simply fork and open a pull request.