Add scripts for building Openness docker images
[icn.git] / tools / openness / eaa / build_image.sh
1 #!/usr/bin/env bash
2
3 set -ex
4
5 source ../_common.sh
6
7 # install_deps() - Install dependencies required for build eaa image
8 function install_deps {
9     if ! $(go version &>/dev/null); then
10         _install_go
11     fi
12
13     if ! $(docker version &>/dev/null); then
14         _install_docker
15     fi
16
17     if ! $(patch -v &>/dev/null); then
18         apt-get update && apt-get install patch
19     fi
20 }
21
22 install_deps
23 mkdir -p /tmp/openness
24 cp ./BUILD-EAA-IMAGE.patch /tmp/openness/
25 cd /tmp/openness
26 wget https://github.com/open-ness/edgenode/archive/openness-19.12.01.tar.gz
27 tar xvf openness-19.12.01.tar.gz
28 cd edgenode-openness-19.12.01
29 patch -p1 < ../BUILD-EAA-IMAGE.patch
30 GOOS=linux go build -o "./build/eaa/eaa" ./cmd/eaa
31 cd build/eaa
32 docker build -t integratedcloudnative/eaa:1.0 .
33 cd /tmp
34 rm -rf /tmp/openness