diff options
Diffstat (limited to 'tools/build-c2m.sh')
-rwxr-xr-x | tools/build-c2m.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/build-c2m.sh b/tools/build-c2m.sh new file mode 100755 index 000000000..b5ad40fb8 --- /dev/null +++ b/tools/build-c2m.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Copyright 2021 Nokia +# Licensed under the Apache License 2.0 +# SPDX-License-Identifier: Apache-2.0 + +# Build script to create c2m container. + +set -x + +build_env="no_proxy" +proxy="" +if [[ -z "${http_proxy}" ]]; then + echo "http_proxy is empty" +else + echo "http_proxy is set to $http_proxy" + build_env="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 + echo "Acquire::http::Proxy \"${proxy}\";" > proxy.conf +fi + +echo "Proxy set to $proxy, build env is $build_env." + +docker build --no-cache --build-arg http_proxy=$proxy --build-arg https_proxy=$proxy --build-arg build_env=$build_env -t c2m:latest -t c2m:`git log -1 --format=%h` . || echo "Build failed." |