A CI compatible Go container for Docker

Jan 7, 2016 00:00 · 207 words · 1 minute read continuous integration development docker go

For a few months I now I am heavily relying on Docker and DroneCI for continuous builds of my projects.

Two months ago I decided I should try out Go, and checked out the Docker Hub for official Go images, and yes they exists but sadly they only contain Go, but none of the version control systems required for go get to pick up dependencies.

The Go containers

The Go containers are available now on Docker Hub and include the official Go 1.5 or 1.6 releases, and have tags for 1.5 and 1.6. The latest tag will always point the the current stable Go release.

To supplement the go get functionality of picking up dependencies, each image also contains

  • bzr,
  • git,
  • mercurial

docker pull danielsreichenbach/golang:1.5 will give you a Go 1.5 build environment, and docker pull danielsreichenbach/golang:1.6 (obviously) will provide a Go 1.6 environment.

Now I can e.g. execute builds in DroneCI like this:

clone:
  depth: 1

build:
  image: danielsreichenbach/drone-golang:$$GO_VERSION
  commands:
    - go get -t -v ./...
    - go test -v ./
    - go build -v ./

matrix:
  GO_VERSION:
    - 1.5
    - 1.6

Thanks to the availability of DroneCIs CLI you can also use this locally by running drone exec in a directory containing the .drone.yml file.

Comments powered by Disqus