From 023f799820d784a71847de653b2f20aa68ffba30 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 15 Jan 2016 10:28:52 -0800 Subject: [PATCH] build: Do not hardcode docker binary path Fixes #1035 --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3b3382fcc..77ab94950 100644 --- a/Makefile +++ b/Makefile @@ -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