blob: 7facccaec88e0cff49d301ed48f6a8ae522e3a78 [file] [log] [blame]
Yuta HIGUCHI4e751d02018-05-11 10:22:11 -07001#!/bin/bash -e
Ray Milkey0caba7f2018-01-08 12:56:18 -08002
3# exit on errors
4set -eu -o pipefail
5
Ray Milkeye3f9ad42018-01-08 14:21:44 -08006DOCKER="/usr/bin/docker"
7${DOCKER} --version
8
Ray Milkey0caba7f2018-01-08 12:56:18 -08009# set up ONOS build environment
10ONOS_ROOT=`pwd`
11. tools/build/envDefaults
12
Ray Milkey4840a302018-01-08 16:11:02 -080013# set up release build credentials
14. onos-build-credentials
15
Ray Milkey545efe92018-01-26 10:41:00 -080016# get the sources
Ray Milkey0caba7f2018-01-08 12:56:18 -080017git checkout $GERRIT_BRANCH
Andrea Campanella79b747c2021-08-27 12:07:24 +020018if [[ $ONOS_TAG != *"latest"* ]]; then
19 git checkout -b docker $ONOS_TAG
20fi
Ray Milkey0caba7f2018-01-08 12:56:18 -080021
Ray Milkeyc0d22362018-01-08 13:51:07 -080022# build and deploy the Docker image
Ray Milkeyb40e5672018-01-26 10:10:45 -080023$DOCKER build -t onosproject/onos:${ONOS_TAG} .
Ray Milkeyc0d22362018-01-08 13:51:07 -080024$DOCKER login --username ${DOCKERHUB_USERNAME} --password ${DOCKERHUB_PASSWORD}
Ray Milkeyb40e5672018-01-26 10:10:45 -080025$DOCKER push onosproject/onos:${ONOS_TAG}