Add support for Docker container build behind proxy
Change-Id: I380f7b20f04ad81b487ccc3cafe37a38360dcf00
diff --git a/containers/cord-apps/Makefile b/containers/cord-apps/Makefile
index 191e249..4b789c4 100644
--- a/containers/cord-apps/Makefile
+++ b/containers/cord-apps/Makefile
@@ -3,8 +3,16 @@
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 .
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 bc869f7..d7be421 100644
--- a/containers/xos/Makefile
+++ b/containers/xos/Makefile
@@ -17,7 +17,7 @@
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
XOS_GIT_COMMIT_HASH ?= $(shell git log --pretty=format:'%H' -n 1 || echo -n "unknown" )
@@ -25,29 +25,37 @@
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 \
--build-arg XOS_GIT_COMMIT_HASH="${XOS_GIT_COMMIT_HASH}" \
--build-arg XOS_GIT_COMMIT_DATE="${XOS_GIT_COMMIT_DATE}" \
- -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 \