Merge pull request #127 from andrewhsu/gitcommit

allow override of git hash when building binary
This commit is contained in:
Tibor Vass 2017-05-24 15:57:02 -07:00 committed by GitHub
commit 11e7d35f9c
1 changed files with 4 additions and 3 deletions

View File

@ -9,6 +9,7 @@ LINTER_IMAGE_NAME = docker-cli-lint
CROSS_IMAGE_NAME = docker-cli-cross CROSS_IMAGE_NAME = docker-cli-cross
MOUNTS = -v `pwd`:/go/src/github.com/docker/cli MOUNTS = -v `pwd`:/go/src/github.com/docker/cli
VERSION = $(shell cat VERSION) VERSION = $(shell cat VERSION)
ENVVARS = -e VERSION=$(VERSION) -e GITCOMMIT
# build docker image (dockerfiles/Dockerfile.build) # build docker image (dockerfiles/Dockerfile.build)
.PHONY: build_docker_image .PHONY: build_docker_image
@ -27,7 +28,7 @@ build_cross_image:
# build executable using a container # build executable using a container
binary: build_docker_image binary: build_docker_image
docker run --rm -e VERSION=$(VERSION) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make binary docker run --rm $(ENVVARS) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make binary
build: binary build: binary
@ -44,7 +45,7 @@ test: build_docker_image
# build the CLI for multiple architectures using a container # build the CLI for multiple architectures using a container
.PHONY: cross .PHONY: cross
cross: build_cross_image cross: build_cross_image
docker run --rm -e VERSION=$(VERSION) $(MOUNTS) $(CROSS_IMAGE_NAME) make cross docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make cross
.PHONY: watch .PHONY: watch
watch: build_docker_image watch: build_docker_image
@ -68,4 +69,4 @@ vendor: build_docker_image vendor.conf
docker run -ti --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor docker run -ti --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make vendor
dynbinary: build_cross_image dynbinary: build_cross_image
docker run -ti --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make dynbinary docker run --rm $(ENVVARS) $(MOUNTS) $(CROSS_IMAGE_NAME) make dynbinary