diff options
author | Gergely Csatari <gergely.csatari@nokia.com> | 2021-09-08 11:53:02 +0300 |
---|---|---|
committer | Eric Debeau <eric.debeau@orange.com> | 2021-09-24 20:04:24 +0000 |
commit | 9205c55c1acbb4fb180594b14e50ef20dca9b0db (patch) | |
tree | 4f703ad866dd33017ac14d98fdfd6e57f02c2b79 /tools/build-c2m.sh | |
parent | 12d98eaf24a1c673c867a796520204e7bbb27142 (diff) |
Docker build and run environemnt for c2m
- Dockerfile to build a container for c2m
- A script to build the container
- A script to run the container
- A wrapper script to run c2m in the container
Issue-ID: DOC-762
Signed-off-by: Gergely Csatari <gergely.csatari@nokia.com>
Change-Id: Icea55512658bbb8a78934f2a5b4313345927e7b7
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." |