allow version number to be set in builds

Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
This commit is contained in:
Andrew Hsu 2017-05-22 13:22:42 -07:00
parent 883d28cfce
commit 3dfe334a7a
2 changed files with 4 additions and 3 deletions

View File

@ -8,6 +8,7 @@ DEV_DOCKER_IMAGE_NAME = docker-cli-dev
LINTER_IMAGE_NAME = docker-cli-lint
CROSS_IMAGE_NAME = docker-cli-cross
MOUNTS = -v `pwd`:/go/src/github.com/docker/cli
VERSION = $(shell cat VERSION)
# build docker image (dockerfiles/Dockerfile.build)
.PHONY: build_docker_image
@ -26,7 +27,7 @@ build_cross_image:
# build executable using a container
binary: build_docker_image
docker run --rm $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make binary
docker run --rm -e VERSION=$(VERSION) $(MOUNTS) $(DEV_DOCKER_IMAGE_NAME) make binary
build: binary
@ -43,7 +44,7 @@ test: build_docker_image
# build the CLI for multiple architectures using a container
.PHONY: cross
cross: build_cross_image
docker run --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make cross
docker run --rm -e VERSION=$(VERSION) $(MOUNTS) $(CROSS_IMAGE_NAME) make cross
.PHONY: watch
watch: build_docker_image

View File

@ -11,7 +11,7 @@ export CGO_ENABLED=1
export GOOS=darwin
export GOARCH=amd64
export CC=o64-clang
export LDFLAGS='-linkmode external -s'
export LDFLAGS="$LDFLAGS -linkmode external -s"
export LDFLAGS_STATIC_DOCKER='-extld='${CC}
# Override TARGET