Unifying proxy variables for docker build

This patch adds proxy-related variables to 'docker build' command.

Change-Id: I02f25639a700983ad5f2431bcd917a84375dadb9
This commit is contained in:
Roman Gorshunov 2018-06-22 14:47:57 +02:00
parent b0b0ba021e
commit 18a82a0a70
1 changed files with 27 additions and 19 deletions

View File

@ -12,24 +12,25 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
DOCKER_REGISTRY ?= quay.io DOCKER_REGISTRY ?= quay.io
REGION_SUFFIX ?= maas-region REGION_SUFFIX ?= maas-region
IMG_COMMON_DIR ?= images IMG_COMMON_DIR ?= images
REGION_IMG_DIR ?= images/maas-region-controller REGION_IMG_DIR ?= images/maas-region-controller
RACK_SUFFIX ?= maas-rack RACK_SUFFIX ?= maas-rack
RACK_IMG_DIR ?= images/maas-rack-controller RACK_IMG_DIR ?= images/maas-rack-controller
CACHE_SUFFIX ?= maas-cache CACHE_SUFFIX ?= maas-cache
CACHE_IMG_DIR ?= images/sstream-cache CACHE_IMG_DIR ?= images/sstream-cache
IMAGE_PREFIX ?= airshipit IMAGE_PREFIX ?= airshipit
IMAGE_TAG ?= untagged IMAGE_TAG ?= untagged
PROXY ?= http://one.proxy.att.com:8080 PROXY ?= http://proxy.foo.com:8000
USE_PROXY ?= false NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
PUSH_IMAGE ?= false USE_PROXY ?= false
LABEL ?= commit-id PUSH_IMAGE ?= false
IMAGE_NAME := maas-rack-controller maas-region-controller sstream-cache LABEL ?= commit-id
BUILD_DIR := $(shell mktemp -d) IMAGE_NAME := maas-rack-controller maas-region-controller sstream-cache
HELM := $(BUILD_DIR)/helm BUILD_DIR := $(shell mktemp -d)
SSTREAM_IMAGE := "https://images.maas.io/ephemeral-v3/daily/" HELM := $(BUILD_DIR)/helm
SSTREAM_IMAGE := "https://images.maas.io/ephemeral-v3/daily/"
.PHONY: images .PHONY: images
#Build all images in the list #Build all images in the list
@ -65,7 +66,14 @@ helm-install:
.PHONY: build .PHONY: build
build: build:
ifeq ($(USE_PROXY), true) ifeq ($(USE_PROXY), true)
docker build -t $(IMAGE) --network=host --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile --build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) --build-arg http_proxy=$(PROXY) --build-arg https_proxy=$(PROXY) $(IMAGE_DIR) docker build -t $(IMAGE) --network=host --label $(LABEL) -f $(IMAGE_DIR)/Dockerfile --build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) \
--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) \
$(IMAGE_DIR)
else else
docker build -t $(IMAGE) --network=host --label $(LABEL) --build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) -f $(IMAGE_DIR)/Dockerfile $(IMAGE_DIR) docker build -t $(IMAGE) --network=host --label $(LABEL) --build-arg SSTREAM_IMAGE=$(SSTREAM_IMAGE) -f $(IMAGE_DIR)/Dockerfile $(IMAGE_DIR)
endif endif