Boyuan Yan | 1c27bc7 | 2019-02-15 19:22:19 +0000 | [diff] [blame] | 1 | #!/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 |
| 6 | shopt -s expand_aliases |
| 7 | export PATH="$PATH:$HOME/bin:onos/bin" |
| 8 | export ONOS_ROOT=~/onos |
| 9 | source ${ONOS_ROOT}/tools/dev/bash_profile |
| 10 | |
| 11 | # Compile and Package ONOS |
| 12 | cd ${ONOS_ROOT} |
| 13 | # ob is replaced by bazel build onos |
| 14 | bazel build onos |
| 15 | rtn=$? |
| 16 | if [[ ${rtn} -ne 0 ]] |
| 17 | then |
| 18 | exit ${rtn} |
| 19 | fi |
| 20 | # Re-deploy ONOS |
| 21 | [ -f tools/dev/onos.tar.gz ] && rm -f tools/dev/onos.tar.gz |
| 22 | cp bazel-bin/onos.tar.gz tools/dev/ |
| 23 | # Build ONOS's docker image, and start ONOS cluster through docker |
| 24 | cd tools/dev/ |
| 25 | docker build -t onos -f Dockerfile-dev . |
| 26 | rm -f onos.tar.gz |
| 27 | exit $? |