This is a docker image to build Go projects and docker images. The container will run:
Reports are generated into the buildreport/
directory.
It is heavily inspired by:CenturyLinkLabs golang-builder.
To build the project with valid package references the Go builder needs to create the GOPATH
with proper directories. Which directories these are is not in the Go source code. Options are:
Go allows you to define it via source code comment, for example:
package main // import "github.com/alpe/ci-example-project"
The glide dependency manager allows you to define the root package of your project in it's glide.yaml
configuration file.
package: github.com/alpe/ci-example import: ...
Same with Godeps. You can define the full qualified package name in the Godeps/Godeps.json
file:
{ "ImportPath": "github.com/alpe/ci-example", ... }
An alternative would be to provide a default path which works for all your projects. See the build_environment.sh
.
The build_environment.sh
would be a good start to look how things are currently implemented. Currently supported are:
You'll need a github token that you can pass to the container. It will be persisted in the .netrc
for gpm to access private github repositories.
docker build --build-arg GITHUB_TOKEN=<your-token> -t go-builder .
docker run --rm \ -v $(pwd):/src \ go-builder
docker run --rm \ -v $(pwd):/src \ -v /var/run/docker.sock:/var/run/docker.sock \ go-builder mytag