| #!/bin/bash -e |
| |
| # exit on errors |
| set -eu -o pipefail |
| |
| DOCKER="/usr/bin/docker" |
| ${DOCKER} --version |
| |
| # set up ONOS build environment |
| ONOS_ROOT=`pwd` |
| . tools/build/envDefaults |
| |
| # set up release build credentials |
| . onos-build-credentials |
| |
| # get the sources |
| git checkout $GERRIT_BRANCH |
| if [[ $ONOS_TAG != *"latest"* ]]; then |
| git checkout -b docker $ONOS_TAG |
| fi |
| |
| if [[ $ONOS_TAG == "onos-"* ]]; then |
| ONOS_TAG=${ONOS_TAG#"onos-"} |
| fi |
| |
| # build and deploy the Docker image |
| $DOCKER build -t onosproject/onos:${ONOS_TAG} . |
| $DOCKER login --username ${DOCKERHUB_USERNAME} --password ${DOCKERHUB_PASSWORD} |
| $DOCKER push onosproject/onos:${ONOS_TAG} |