From 47d9cadde3ea38210db0324564960a9853d863a2 Mon Sep 17 00:00:00 2001 From: Shashank Kumar Shankar Date: Wed, 14 Jun 2017 15:32:06 -0700 Subject: Add proxy support in DockerFile This helps to build Portal Docker image behind a proxy. Change-Id: I65fdd952ef9a9060f87dbbdc5a16909c825b493e Signed-off-by: Shashank Kumar Shankar --- deliveries/os_Dockerfile | 9 +++++++++ deliveries/os_build_febe.sh | 13 +++++++++++-- deliveries/os_settings.sh | 2 ++ 3 files changed, 22 insertions(+), 2 deletions(-) (limited to 'deliveries') diff --git a/deliveries/os_Dockerfile b/deliveries/os_Dockerfile index efba0bdd..56faa6ad 100644 --- a/deliveries/os_Dockerfile +++ b/deliveries/os_Dockerfile @@ -3,6 +3,15 @@ FROM ubuntu:14.04 +ARG HTTP_PROXY=${HTTP_PROXY} +ARG HTTPS_PROXY=${HTTPS_PROXY} + +ENV http_proxy $HTTP_PROXY +ENV https_proxy $HTTPS_PROXY + +RUN if [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::http::proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf; fi && \ + if [ ! -z ${HTTPS_PROXY} ]; then echo "Acquire::https::proxy \"${HTTPS_PROXY}\";" >> /etc/apt/apt.conf; fi + # Install the python script required for "add-apt-repository" RUN apt-get update && apt-get install -y software-properties-common diff --git a/deliveries/os_build_febe.sh b/deliveries/os_build_febe.sh index a87831af..2d6117c3 100644 --- a/deliveries/os_build_febe.sh +++ b/deliveries/os_build_febe.sh @@ -84,5 +84,14 @@ cat dbca-create-mysql-1707-os.sql ../../dbca-common/db-scripts/dbca-ddl-mysql-17 # install into docker cd $CURRENTDIR -echo "running: docker build -t ${IMGNAME} --build-arg VERSION=${VERSION} --build-arg PORTAL_SDK_DIR=${PORTAL_SDK_DIR} --build-arg SDK_DIR=${SDK_DIR} --build-arg FE_DIR=${FE_DIR} --build-arg PORTAL_DBC_DIR=${PORTAL_DBC_DIR} -f ./os_Dockerfile ." -docker build -t ${IMGNAME} --build-arg VERSION=${VERSION} --build-arg PORTAL_SDK_DIR=${PORTAL_SDK_DIR} --build-arg SDK_DIR=${SDK_DIR} --build-arg FE_DIR=${FE_DIR} --build-arg PORTAL_DBC_DIR=${PORTAL_DBC_DIR} -f ./os_Dockerfile . +PROXY_ARGS="" +if [ $HTTP_PROXY ]; then + PROXY_ARGS+="--build-arg HTTP_PROXY=${HTTP_PROXY}" +fi +if [ $HTTPS_PROXY ]; then + PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}" +fi + +EXEC_CMD="docker build -t ${IMGNAME} ${PROXY_ARGS} --build-arg VERSION=${VERSION} --build-arg PORTAL_SDK_DIR=${PORTAL_SDK_DIR} --build-arg SDK_DIR=${SDK_DIR} --build-arg FE_DIR=${FE_DIR} --build-arg PORTAL_DBC_DIR=${PORTAL_DBC_DIR} -f ./os_Dockerfile ." +echo $EXEC_CMD +$EXEC_CMD \ No newline at end of file diff --git a/deliveries/os_settings.sh b/deliveries/os_settings.sh index d4ab1853..0ad53fdc 100644 --- a/deliveries/os_settings.sh +++ b/deliveries/os_settings.sh @@ -1,3 +1,5 @@ +#!/bin/bash + IMGNAME=ep:1610-1 VERSION=1.1.0-SNAPSHOT ETCDIR=etc -- cgit 1.2.3-korg