blob: b5ad40fb84f724a57062b1fe27e72e161de1dc19 [file] [log] [blame]
Gergely Csatari9205c552021-09-08 11:53:02 +03001#!/bin/bash
2
3# Copyright 2021 Nokia
4# Licensed under the Apache License 2.0
5# SPDX-License-Identifier: Apache-2.0
6
7# Build script to create c2m container.
8
9set -x
10
11build_env="no_proxy"
12proxy=""
13if [[ -z "${http_proxy}" ]]; then
14 echo "http_proxy is empty"
15else
16 echo "http_proxy is set to $http_proxy"
17 build_env="proxy"
18 if [[ $http_proxy =~ ^http:\/\/[0-9] ]]; then
19 echo "starts with http"
20 proxy=$http_proxy
21 elif [[ $http_proxy =~ ^[0-9] ]]; then
22 echo "starts with number"
23 proxy=http://$http_proxy
24 fi
25 echo "Acquire::http::Proxy \"${proxy}\";" > proxy.conf
26fi
27
28echo "Proxy set to $proxy, build env is $build_env."
29
30docker 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."