Sha256: ff506f8c43a346710e96d0aba1259f9209ddec979f5ffa2faa100d4de7f44d8e

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

#!/bin/bash
#
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

function usage
{
 echo "usage is $0 [--help][-t user/repo:version]
Script to build a docker image.
It takes your local setting of $http_proxy to build the image with the same proxy
If the proxy is not set, the docker image is simply executed, without proxy.

Options :
- help: is the current help
- t   : Tag the image built. Respect the tag format use by docker -t option.
"
}

if [ "p$1" = "p--help" ]
then
   usage
   exit
fi

if [ "p$1" = "p-t" ] && [ "p$2" != "" ]
then
   TAG="-t $2"
fi

if [ "$http_proxy" = "" ]
then
   echo "Currently, no proxy is set. Running docker without proxy"
   docker build $TAG
   exit
fi

mkdir .tmp
awk '$0 ~ /RUN \/tmp\/proxy.sh/ { print "ENV http_proxy '"$http_proxy"'" }
     $0 ~ // { print $0 } ' Dockerfile > .tmp/Dockerfile
cp -rp files tmp .tmp/
docker build $TAG .tmp
rm -fr .tmp

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
config_layers-0.1.4 build/build_with_proxy.sh
subhash-0.1.2 build/build_with_proxy.sh