Skip to content

Commit

Permalink
[FAB-2829]-Build fails if Docker flags contain spaces
Browse files Browse the repository at this point in the history
There are cases where the make script setting DOCKER_BUILD_FLAGS and
DOCKER_RUN_FLAGS that are used to set DBUILD and DRUN variables
generate values containing whitespace.

https://jira.hyperledger.org/browse/FAB-2829

- Enclosed variables to prevent spaces breaking docker build and docker run commands.
- Tested build on OSX (10.12.3), Debian 8.7 and Windows 10

Change-Id: Ie353c6561dc1abecc05201205ef46b43608af6ac
Signed-off-by: Nick Murray <nick@passkit.com>
  • Loading branch information
pkpfr committed Mar 19, 2017
1 parent 22c1a1f commit 5b59e06
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions docker-env.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,28 @@ endif
endif

ifneq ($(http_proxy),)
DOCKER_BUILD_FLAGS+=--build-arg http_proxy=$(http_proxy)
DOCKER_RUN_FLAGS+=-e http_proxy=$(http_proxy)
DOCKER_BUILD_FLAGS+=--build-arg 'http_proxy=$(http_proxy)'
DOCKER_RUN_FLAGS+=-e 'http_proxy=$(http_proxy)'
endif
ifneq ($(https_proxy),)
DOCKER_BUILD_FLAGS+=--build-arg https_proxy=$(https_proxy)
DOCKER_RUN_FLAGS+=-e https_proxy=$(https_proxy)
DOCKER_BUILD_FLAGS+=--build-arg 'https_proxy=$(https_proxy)'
DOCKER_RUN_FLAGS+=-e 'https_proxy=$(https_proxy)'
endif
ifneq ($(HTTP_PROXY),)
DOCKER_BUILD_FLAGS+=--build-arg HTTP_PROXY=$(HTTP_PROXY)
DOCKER_RUN_FLAGS+=-e HTTP_PROXY=$(HTTP_PROXY)
DOCKER_BUILD_FLAGS+=--build-arg 'HTTP_PROXY=$(HTTP_PROXY)'
DOCKER_RUN_FLAGS+=-e 'HTTP_PROXY=$(HTTP_PROXY)'
endif
ifneq ($(HTTPS_PROXY),)
DOCKER_BUILD_FLAGS+=--build-arg HTTPS_PROXY=$(HTTPS_PROXY)
DOCKER_RUN_FLAGS+=-e HTTPS_PROXY=$(HTTPS_PROXY)
DOCKER_BUILD_FLAGS+=--build-arg 'HTTPS_PROXY=$(HTTPS_PROXY)'
DOCKER_RUN_FLAGS+=-e 'HTTPS_PROXY=$(HTTPS_PROXY)'
endif
ifneq ($(no_proxy),)
DOCKER_BUILD_FLAGS+=--build-arg no_proxy=$(no_proxy)
DOCKER_RUN_FLAGS+=-e no_proxy=$(no_proxy)
DOCKER_BUILD_FLAGS+=--build-arg 'no_proxy=$(no_proxy)'
DOCKER_RUN_FLAGS+=-e 'no_proxy=$(no_proxy)'
endif
ifneq ($(NO_PROXY),)
DOCKER_BUILD_FLAGS+=--build-arg NO_PROXY=$(NO_PROXY)
DOCKER_RUN_FLAGS+=-e NO_PROXY=$(NO_PROXY)
DOCKER_BUILD_FLAGS+=--build-arg 'NO_PROXY=$(NO_PROXY)'
DOCKER_RUN_FLAGS+=-e 'NO_PROXY=$(NO_PROXY)'
endif

DRUN = docker run -i --rm $(DOCKER_RUN_FLAGS) \
Expand Down

0 comments on commit 5b59e06

Please sign in to comment.