Add support for Docker container build behind proxy
Add -b cord-1.0 for ONOS app builds

Change-Id: I380f7b20f04ad81b487ccc3cafe37a38360dcf00
diff --git a/containers/cord-apps/Dockerfile.config b/containers/cord-apps/Dockerfile.config
index 4f34178..bf6dddf 100644
--- a/containers/cord-apps/Dockerfile.config
+++ b/containers/cord-apps/Dockerfile.config
@@ -2,7 +2,7 @@
 MAINTAINER Andy Bavier <andy@onlab.us>
 
 WORKDIR /src
-RUN     git clone https://gerrit.opencord.org/p/config.git && cd config && \
+RUN     git clone -b cord-1.0 https://gerrit.opencord.org/p/config.git && cd config && \
         mvn clean install
 
 CMD bash -c "source /root/.bashrc; onos-app onos-cord-1 install /src/config/target/cord-config-*.oar && onos-app onos-cord-1 activate org.opencord.config"
\ No newline at end of file
diff --git a/containers/cord-apps/Dockerfile.vtn b/containers/cord-apps/Dockerfile.vtn
index 6132284..544c88f 100644
--- a/containers/cord-apps/Dockerfile.vtn
+++ b/containers/cord-apps/Dockerfile.vtn
@@ -2,7 +2,7 @@
 MAINTAINER Andy Bavier <andy@onlab.us>
 
 WORKDIR /src
-RUN     git clone https://gerrit.opencord.org/p/vtn.git && cd vtn && \
+RUN     git clone -b cord-1.0 https://gerrit.opencord.org/p/vtn.git && cd vtn && \
         mvn clean install
 
 CMD bash -c "source /root/.bashrc; onos-app onos-cord-1 install /src/vtn/target/vtn-*.oar && onos-app onos-cord-1 activate org.opencord.vtn"
diff --git a/containers/cord-apps/Makefile b/containers/cord-apps/Makefile
index 191e249..76b0b87 100644
--- a/containers/cord-apps/Makefile
+++ b/containers/cord-apps/Makefile
@@ -3,11 +3,19 @@
 VTN_IMAGE_NAME:=xosproject/cord-app-vtn
 NO_DOCKER_CACHE?=false
 
+BUILD_ARGS =
+ifdef http_proxy
+BUILD_ARGS += --build-arg http_proxy=${http_proxy}
+endif
+ifdef https_proxy
+BUILD_ARGS += --build-arg https_proxy=${https_proxy}
+endif
+
 .PHONY: build
-build: ; sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} .
+build: ; sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} ${BUILD_ARGS} .
 
 .PHONY: config
-config: ; sudo docker build --rm -t ${CONFIG_IMAGE_NAME} -f Dockerfile.config .
+config: ; sudo docker build --rm -t ${CONFIG_IMAGE_NAME} -f Dockerfile.config ${BUILD_ARGS} .
 
 .PHONY: vtn
-vtn: ; sudo docker build --rm -t ${VTN_IMAGE_NAME} -f Dockerfile.vtn .
+vtn: ; sudo docker build --rm -t ${VTN_IMAGE_NAME} -f Dockerfile.vtn ${BUILD_ARGS} .
diff --git a/containers/onboarding_synchronizer/Makefile b/containers/onboarding_synchronizer/Makefile
index 6532196..c6d2a6b 100644
--- a/containers/onboarding_synchronizer/Makefile
+++ b/containers/onboarding_synchronizer/Makefile
@@ -2,8 +2,16 @@
 CONTAINER_NAME:=xos-synchronizer
 NO_DOCKER_CACHE?=false
 
+BUILD_ARGS =
+ifdef http_proxy
+BUILD_ARGS += --build-arg http_proxy=${http_proxy}
+endif
+ifdef https_proxy
+BUILD_ARGS += --build-arg https_proxy=${https_proxy}
+endif
+
 .PHONY: build
-build: ; sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} .
+build: ; sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} ${BUILD_ARGS} .
 
 .PHONY: run
 run: ; sudo docker run -d --name ${CONTAINER_NAME} -v /usr/local/share/ca-certificates:/usr/local/share/ca-certificates:ro ${IMAGE_NAME}
diff --git a/containers/onos/Makefile b/containers/onos/Makefile
index 4db1a9b..19a9700 100644
--- a/containers/onos/Makefile
+++ b/containers/onos/Makefile
@@ -2,8 +2,16 @@
 CONTAINER_NAME:=onos-fork
 NO_DOCKER_CACHE?=false
 
+BUILD_ARGS =
+ifdef http_proxy
+BUILD_ARGS += --build-arg http_proxy=${http_proxy}
+endif
+ifdef https_proxy
+BUILD_ARGS += --build-arg https_proxy=${https_proxy}
+endif
+
 .PHONY: build
-build: ; sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} .
+build: ; sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} ${BUILD_ARGS} .
 
 .PHONY: run
 run: ; sudo docker run -d --name ${CONTAINER_NAME} ${IMAGE_NAME}
diff --git a/containers/xos/Dockerfile b/containers/xos/Dockerfile
index 98ba9a3..e19b40c 100644
--- a/containers/xos/Dockerfile
+++ b/containers/xos/Dockerfile
@@ -5,7 +5,7 @@
 RUN update-ca-certificates
 
 # Install and boostrap XOS and Tosca
-ENV XOS_GIT_REPO git://github.com/open-cloud/xos.git
+ENV XOS_GIT_REPO https://github.com/opencord/xos.git
 ENV XOS_GIT_BRANCH master
 
 RUN git clone $XOS_GIT_REPO -b $XOS_GIT_BRANCH /tmp/xos && \
diff --git a/containers/xos/Makefile b/containers/xos/Makefile
index 1f856b7..4e436df 100644
--- a/containers/xos/Makefile
+++ b/containers/xos/Makefile
@@ -17,32 +17,40 @@
 CONTAINER_NAME     ?= xos-server
 IMAGE_NAME         ?= xosproject/xos
 
-XOS_GIT_REPO       ?= git://github.com/open-cloud/xos.git
+XOS_GIT_REPO       ?= https://github.com/opencord/xos.git
 XOS_GIT_BRANCH     ?= master
 
 TOSCA_CONFIG_PATH  ?= /opt/xos/configurations/opencloud/opencloud.yaml
 
+BUILD_ARGS =
+ifdef http_proxy
+BUILD_ARGS += --build-arg http_proxy=${http_proxy}
+endif
+ifdef https_proxy
+BUILD_ARGS += --build-arg https_proxy=${https_proxy}
+endif
+
 base:
 	sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm \
-	-f Dockerfile.base -t xosproject/xos-base .
+	-f Dockerfile.base -t xosproject/xos-base ${BUILD_ARGS} .
 
 build:
 	sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm \
-	-f Dockerfile -t ${IMAGE_NAME} .
+	-f Dockerfile -t ${IMAGE_NAME} ${BUILD_ARGS} .
 
 custom:
 	docker build --no-cache=${NO_DOCKER_CACHE} --rm \
 	--build-arg XOS_GIT_REPO=${XOS_GIT_REPO} \
 	--build-arg XOS_GIT_BRANCH=${XOS_GIT_BRANCH} \
-	-f Dockerfile -t ${IMAGE_NAME} .
+	-f Dockerfile -t ${IMAGE_NAME} ${BUILD_ARGS} .
 
 devel:
 	sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm \
-	-f Dockerfile.devel -t ${IMAGE_NAME} ../..
+	-f Dockerfile.devel -t ${IMAGE_NAME} ${BUILD_ARGS} ../..
 
 test:
 	sudo docker build --no-cache=${NO_DOCKER_CACHE} --rm \
-	-f Dockerfile.test -t xosproject/xos-test ../..
+	-f Dockerfile.test -t xosproject/xos-test ${BUILD_ARGS} ../..
 
 run:
 	sudo docker run -d --name ${CONTAINER_NAME} -p 80:8000 \