Commit e03df513 authored by Gergely Csatari's avatar Gergely Csatari
Browse files

Making docker build work behind http proxy



As some of us are working behind corporate firewalls
and some of us are not the docker build and execution
should work in both proxy and non proxy environemnt.
This chnage adds this support.

Note: npm gives a warning when no proxy is used. I could not
figure out any good way to work this around. Any comments are welcome.

Change-Id: Ic9afb1c83fbe33fd2c78d913d3c7c8e10200a2b4
Signed-off-by: Gergely Csatari's avatarGergely Csatari <gergely.csatari@nokia.com>
parent 25b19d61
......@@ -3,10 +3,18 @@
FROM alpine:3.6
#ENV http_proxy http://10.144.1.10:8080
#ENV https_proxy something
#ENV HTTP_PROXY
#ENV HTTPS_PROXY
#ENV no_proxy
RUN env
RUN apk update
RUN apk add bash
RUN apk add nodejs
RUN apk add nodejs-npm
RUN npm config set proxy $http_proxy
RUN npm install -g swagger-tools@0.10.3
RUN npm install -g json-refs@3.0.2
RUN npm install -g yamljs@0.3.0
......
......@@ -2,4 +2,24 @@
# Copyright ETSI 2017
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt
docker build -t openapivalidator .
\ No newline at end of file
#set -x
proxy = ""
if [[ ! -v http_proxy ]]; then
echo "http_proxy is not set"
elif [[ -z "$http_proxy" ]]; then
echo "http_proxy is empty"
else
echo "http_proxy is set to $http_proxy"
if [[ $http_proxy =~ ^http:\/\/[0-9] ]]; then
echo "starts with http"
proxy=$http_proxy
elif [[ $http_proxy =~ ^[0-9] ]]; then
echo "starts with number"
proxy=http://$http_proxy
fi
fi
echo "Proxy set to $proxy"
docker build --build-arg http_proxy=$proxy -t openapivalidator .
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment