Add conditional proxy values to Makefile
Need proxy values when image being built behind a firewall. Change-Id: Ib0be7db3c6508cc69ca8db313b84d9cf2d56b0a4
This commit is contained in:
parent
e2a0179fb6
commit
4c3021fa52
16
Makefile
16
Makefile
@ -18,6 +18,9 @@ IMAGE_PREFIX ?= attcomdev
|
||||
IMAGE_TAG ?= ocata
|
||||
HELM ?= helm
|
||||
LABEL ?= commit-id
|
||||
PROXY ?= http://proxy.foo.com:8000
|
||||
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||
USE_PROXY ?= false
|
||||
|
||||
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
|
||||
|
||||
@ -43,7 +46,18 @@ dry-run: clean
|
||||
# Make targets intended for use by the primary targets above.
|
||||
.PHONY: build_$(IMAGE_NAME)
|
||||
build_$(IMAGE_NAME):
|
||||
docker build -t $(IMAGE) --label $(LABEL) -f Dockerfile .
|
||||
|
||||
ifeq ($(USE_PROXY), true)
|
||||
docker build --network host -t $(IMAGE) --label $(LABEL) -f Dockerfile \
|
||||
--build-arg http_proxy=$(PROXY) \
|
||||
--build-arg https_proxy=$(PROXY) \
|
||||
--build-arg HTTP_PROXY=$(PROXY) \
|
||||
--build-arg HTTPS_PROXY=$(PROXY) \
|
||||
--build-arg no_proxy=$(NO_PROXY) \
|
||||
--build-arg NO_PROXY=$(NO_PROXY) .
|
||||
else
|
||||
docker build --network host -t $(IMAGE) --label $(LABEL) -f Dockerfile .
|
||||
endif
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
1
tox.ini
1
tox.ini
@ -5,6 +5,7 @@ skipsdist = True
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
|
||||
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
|
Loading…
x
Reference in New Issue
Block a user