Merge pull request #1036 from harshavardhana/docker

build: Do not hardcode docker binary path
This commit is contained in:
Harshavardhana 2016-01-15 10:42:13 -08:00
commit 8a7bf0dde0

View File

@ -1,4 +1,5 @@
LDFLAGS := $(shell go run buildscripts/gen-ldflags.go)
DOCKER_BIN := $(shell which docker)
DOCKER_LDFLAGS := '$(LDFLAGS) -extldflags "-static"'
BUILD_LDFLAGS := '$(LDFLAGS)'
TAG := latest
@ -14,6 +15,10 @@ checkgopath:
@for miniopath in $(echo ${GOPATH} | sed 's/:/\n/g'); do if [ ! -d ${miniopath}/src/github.com/minio/minio ]; then echo "Project not found in ${miniopath}, please follow instructions provided at https://github.com/minio/minio/blob/master/CONTRIBUTING.md#setup-your-minio-github-repository" && exit 1; fi done
@echo "Setting BUILD_LDFLAGS: ${BUILD_LDFLAGS}"
checkdocker:
@echo "Checking if docker is installed.. "
@if [ -z ${DOCKER_BIN} ]; then echo "Docker not installed, cannot build docker image. Please install 'sudo apt-get install docker.io'" && exit 1; else echo "Docker installed at ${DOCKER_BIN}."; fi;
getdeps: checkdeps checkgopath
@go get -u github.com/golang/lint/golint && echo "Installed golint:"
@go get -u golang.org/x/tools/cmd/vet && echo "Installed vet:"
@ -69,9 +74,7 @@ pkg-remove:
install: gomake-all
dockerimage: install
@echo "Checking if docker is installed."
@if [ ! -e /usr/bin/docker ]; then echo "Docker not installed, cannot build docker image. Please install 'sudo apt-get install docker.io'" && exit 1; fi
dockerimage: checkdocker verifiers
@echo "Building docker image:" minio:$(TAG)
@GO15VENDOREXPERIMENT=1 go build --ldflags $(DOCKER_LDFLAGS) -o minio.dockerimage
@mkdir -p export