Unifying proxy variables for tox and docker build

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

Change-Id: I019bb0ff5a5eb48b0a9bec6f202a5d3022b8095c
This commit is contained in:
Roman Gorshunov 2018-06-22 14:59:01 +02:00
parent 04906cce68
commit 1e9a21897a
2 changed files with 27 additions and 12 deletions

View File

@ -12,16 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
BUILD_CTX ?= src/bin
DOCKER_REGISTRY ?= quay.io
IMAGE_PREFIX ?= airshipit
IMAGE_TAG ?= untagged
HELM ?= helm
LABEL ?= commit-id
IMAGE_NAME := airflow shipyard
PROXY ?= http://proxy.foo.com:8080
USE_PROXY ?= false
PUSH_IMAGE ?= false
BUILD_CTX ?= src/bin
DOCKER_REGISTRY ?= quay.io
IMAGE_PREFIX ?= airshipit
IMAGE_TAG ?= untagged
HELM ?= helm
LABEL ?= commit-id
IMAGE_NAME := airflow shipyard
PROXY ?= http://proxy.foo.com:8000
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
USE_PROXY ?= false
PUSH_IMAGE ?= false
IMAGE:=${DOCKER_REGISTRY}/${IMAGE_PREFIX}/$(IMAGE_NAME):${IMAGE_TAG}
IMAGE_DIR:=images/$(IMAGE_NAME)
@ -79,7 +80,14 @@ run:
.PHONY: build_airflow
build_airflow:
ifeq ($(USE_PROXY), true)
docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile --build-arg http_proxy=$(PROXY) --build-arg https_proxy=$(PROXY) --build-arg ctx_base=$(BUILD_CTX) .
docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/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) \
--build-arg ctx_base=$(BUILD_CTX) .
else
docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile --build-arg ctx_base=$(BUILD_CTX) .
endif
@ -90,7 +98,13 @@ endif
.PHONY: build_shipyard
build_shipyard:
ifeq ($(USE_PROXY), true)
docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile --build-arg ctx_base=$(BUILD_CTX) . --build-arg http_proxy=$(PROXY) --build-arg https_proxy=$(PROXY)
docker build --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile --build-arg ctx_base=$(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 --network host -t $(IMAGE) --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile --build-arg ctx_base=$(BUILD_CTX) .
endif

View File

@ -5,6 +5,7 @@ envlist = all_jobs, docs
[testenv]
setenv=
PYTHONWARNING=all
passenv=HTTP_PROXY HTTPS_PROXY http_proxy https_proxy NO_PROXY no_proxy
basepython=python3.5
# Please use `make docs` instead