build: Do not hardcode docker binary path

Fixes #1035
master
Harshavardhana 9 years ago
parent 8ff43086fb
commit 023f799820
  1. 9
      Makefile

@ -1,4 +1,5 @@
LDFLAGS := $(shell go run buildscripts/gen-ldflags.go) LDFLAGS := $(shell go run buildscripts/gen-ldflags.go)
DOCKER_BIN := $(shell which docker)
DOCKER_LDFLAGS := '$(LDFLAGS) -extldflags "-static"' DOCKER_LDFLAGS := '$(LDFLAGS) -extldflags "-static"'
BUILD_LDFLAGS := '$(LDFLAGS)' BUILD_LDFLAGS := '$(LDFLAGS)'
TAG := latest 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 @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}" @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 getdeps: checkdeps checkgopath
@go get -u github.com/golang/lint/golint && echo "Installed golint:" @go get -u github.com/golang/lint/golint && echo "Installed golint:"
@go get -u golang.org/x/tools/cmd/vet && echo "Installed vet:" @go get -u golang.org/x/tools/cmd/vet && echo "Installed vet:"
@ -69,9 +74,7 @@ pkg-remove:
install: gomake-all install: gomake-all
dockerimage: install dockerimage: checkdocker verifiers
@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
@echo "Building docker image:" minio:$(TAG) @echo "Building docker image:" minio:$(TAG)
@GO15VENDOREXPERIMENT=1 go build --ldflags $(DOCKER_LDFLAGS) -o minio.dockerimage @GO15VENDOREXPERIMENT=1 go build --ldflags $(DOCKER_LDFLAGS) -o minio.dockerimage
@mkdir -p export @mkdir -p export

Loading…
Cancel
Save