#!/bin/bash set -e BUILD_IMAGE_NAME="docker-machine-build" GOOS=${GOOS:-"darwin linux windows"} GOARCH=${GOARCH:-"386 amd64 arm"} # Build image for compilation if not detected if [[ $(docker images -q ${BUILD_IMAGE_NAME} | wc -l) -ne 1 ]]; then docker build -t ${BUILD_IMAGE_NAME} . fi docker run --rm \ -v `pwd`:/go/src/github.com/docker/machine \ ${BUILD_IMAGE_NAME} \ gox \ -os "$GOOS" \ -arch "$GOARCH" \ -output="docker-machine_{{.OS}}-{{.Arch}}" \ -ldflags="-w -X github.com/docker/machine/version.GitCommit `git rev-parse --short HEAD`"