Docker: support build behind proxy

This PS adds support to build behind a corp proxy.

Change-Id: I435065e99113f2319101b6cd2924edc4a94b03be
Signed-off-by: Pete Birley <pete@port.direct>
This commit is contained in:
Pete Birley 2018-06-08 09:17:21 -05:00
parent aadf9ae938
commit 17973c5d7d

View File

@ -17,6 +17,9 @@ IMAGE_NAME ?= deckhand
IMAGE_PREFIX ?= attcomdev
IMAGE_TAG ?= latest
HELM ?= helm
PROXY ?= http://proxy.foo.com:8000
USE_PROXY ?= false
PUSH_IMAGE ?= false
LABEL ?= commit-id
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
@ -48,7 +51,14 @@ tests:
# Make targets intended for use by the primary targets above.
.PHONY: build_deckhand
build_deckhand:
docker build -t $(IMAGE) --label $(LABEL) -f images/deckhand/Dockerfile .
ifeq ($(USE_PROXY), true)
docker build --network host -t $(IMAGE) --label $(LABEL) -f images/deckhand/Dockerfile . --build-arg http_proxy=$(PROXY) --build-arg https_proxy=$(PROXY)
else
docker build --network host -t $(IMAGE) --label $(LABEL) -f images/deckhand/Dockerfile .
endif
ifeq ($(PUSH_IMAGE), true)
docker push $(IMAGE)
endif
.PHONY: clean
clean: