Add proxy support 33/5233/1
authorVictor Morales <victor.morales@intel.com>
Fri, 23 Jun 2017 19:58:24 +0000 (14:58 -0500)
committerVictor Morales <victor.morales@intel.com>
Fri, 23 Jun 2017 19:58:24 +0000 (14:58 -0500)
It's not possible to build the Docker images behind a corporate
proxy. This change adds support to HTTP and HTTPS protocols for
creation of images.

Change-Id: Ic5fffd3ecbaa1406ff9a27203f6aca43aa971704
Signed-off-by: Victor Morales <victor.morales@intel.com>
Former-commit-id: 177e59e42d10ff5927d7f92b5bf87a244af67626

installation/ubuntu/src/main/docker/Dockerfile

index 5d5b1b8..7d8e6eb 100644 (file)
@@ -1,7 +1,15 @@
 # Base ubuntu with added packages needed for open ecomp
 FROM ubuntu:16.04
 MAINTAINER SDN-C Team (sdnc@lists.openecomp.org)
-# Set proxy if needed
-# RUN echo 'Acquire::http::Proxy "http://your.proxy.com:8080";' > /etc/apt/apt.conf
+
+ARG HTTP_PROXY
+ARG 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
+
 # Add tools needed for OpenDaylight
 RUN apt-get update && apt-get install -y git openjdk-8-jdk maven mysql-client nodejs nodejs-legacy python-pip graphviz npm unzip