CenturyLinkLabs / golang-builder

Containerized build environment for compiling an executable Golang package and packaging it in a light-weight Docker container.
Apache License 2.0
398 stars 85 forks source link

allow to override cross compilation targets #8

Closed linki closed 9 years ago

linki commented 9 years ago

adds the possibility to pass cross-compilation targets to golang-builder-cross to allow building go binaries for arm.

the following example will build linux binaries for amd64 and arm.

docker run --rm \
  -e BUILD_GOOS="linux" \
  -e BUILD_GOARCH="arm amd64" \
  -v $(pwd):/src \
  centurylink/golang-builder-cross

it falls back to the original behaviour if no env vars are defined.

i'm using it successfully to build a dockerui image for an rpi2: https://registry.hub.docker.com/u/linki/rpi-dockerui/

dpetersen commented 9 years ago

Great, thank you! I've tested this locally and it's now pushed to the Docker hub, so centurylink/golang-builder-cross:latest has your changes incorporated.