blob: 18447148205a75b25b38962188553ae3d0c27b39 [file] [log] [blame]
Boyuan Yan1c27bc72019-02-15 19:22:19 +00001#!/bin/bash
2
3# This script is used to build onos by using bazel, and create related docker image from ${ONOS_ROOT}/tools/dev/Dockerfile-dev
4
5# Initialize the environment
6shopt -s expand_aliases
7export PATH="$PATH:$HOME/bin:onos/bin"
8export ONOS_ROOT=~/onos
9source ${ONOS_ROOT}/tools/dev/bash_profile
10
11# Compile and Package ONOS
12cd ${ONOS_ROOT}
13# ob is replaced by bazel build onos
14bazel build onos
15rtn=$?
16if [[ ${rtn} -ne 0 ]]
17then
18 exit ${rtn}
19fi
20# Re-deploy ONOS
21[ -f tools/dev/onos.tar.gz ] && rm -f tools/dev/onos.tar.gz
22cp bazel-bin/onos.tar.gz tools/dev/
23# Build ONOS's docker image, and start ONOS cluster through docker
24cd tools/dev/
25docker build -t onos -f Dockerfile-dev .
26rm -f onos.tar.gz
27exit $?