Unifying proxy variables for tox and docker build

This patch adds proxy-related variables to tox and 'docker build'
commands.

Change-Id: Ie749d6da8643abdb78c3d58e2ea2c1f2964bf186
This commit is contained in:
Roman Gorshunov 2018-06-22 14:48:59 +02:00
parent 1982ec8815
commit d9722326e9
2 changed files with 20 additions and 12 deletions

View File

@ -12,17 +12,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
PEGLEG_BUILD_CTX ?= src/bin/pegleg
IMAGE_NAME ?= pegleg
IMAGE_PREFIX ?= attcomdev
DOCKER_REGISTRY ?= quay.io
IMAGE_TAG ?= latest
HELM ?= helm
PROXY ?= http://proxy_url
USE_PROXY ?= false
PUSH_IMAGE ?= false
LABEL ?= commit-id
IMAGE ?= $(DOCKER_REGISTRY)/$(IMAGE_PREFIX)/$(IMAGE_NAME):$(IMAGE_TAG)
PEGLEG_BUILD_CTX ?= src/bin/pegleg
IMAGE_NAME ?= pegleg
IMAGE_PREFIX ?= attcomdev
DOCKER_REGISTRY ?= quay.io
IMAGE_TAG ?= latest
HELM ?= helm
PROXY ?= http://proxy.foo.com:8000
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
USE_PROXY ?= false
PUSH_IMAGE ?= false
LABEL ?= commit-id
IMAGE ?= $(DOCKER_REGISTRY)/$(IMAGE_PREFIX)/$(IMAGE_NAME):$(IMAGE_TAG)
export
# Build all docker images for this project
@ -61,7 +62,13 @@ format: py_format
.PHONY: build_pegleg
build_pegleg:
ifeq ($(USE_PROXY), true)
docker build -t $(IMAGE) --network=host --label $(LABEL) -f images/pegleg/Dockerfile --build-arg ctx_base=$(PEGLEG_BUILD_CTX) --build-arg http_proxy=$(PROXY) --build-arg https_proxy=$(PROXY) .
docker build -t $(IMAGE) --network=host --label $(LABEL) -f images/pegleg/Dockerfile --build-arg ctx_base=$(PEGLEG_BUILD_CTX) \
--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 -t $(IMAGE) --network=host --label $(LABEL) -f images/pegleg/Dockerfile --build-arg ctx_base=$(PEGLEG_BUILD_CTX) .
endif

View File

@ -8,6 +8,7 @@ skipsdist = True
setenv = VIRTUAL_ENV={envdir}
LANGUAGE=en_US
LC_ALL=en_US.utf-8
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
[testenv:py35]
commands =