echo "building the gradle project"
./gradlew clean bootJar
echo "building docker image"
TAG=1.0.1
NAME=image-name
NAMESPACE=namespace-name
docker build -t $NAME:$TAG .
echo "pushing image to openshift internal registry"
export REGISTRY=$(oc get routes -n openshift-image-registry -o jsonpath='{.items[0].spec.host}')
echo $(oc whoami -t) | docker login $REGISTRY -u $(oc whoami) --password-stdin
docker tag $NAME:$TAG $REGISTRY/$NAMESPACE/$NAME:$TAG
docker push $REGISTRY/$NAMESPACE/$NAME:$TAG