Manjunath Ranganathaiah | b4133b7 | 2018-08-23 15:30:53 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | set -e |
| 3 | DIRNAME=`dirname $0` |
| 4 | DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd` |
| 5 | echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}" |
| 6 | cd ${DOCKER_BUILD_DIR} |
| 7 | |
| 8 | BUILD_ARGS="--no-cache" |
| 9 | ORG="onap" |
| 10 | VERSION="3.0.0" |
| 11 | PROJECT="aaf" |
| 12 | IMAGE="abrmd" |
| 13 | DOCKER_REPOSITORY="nexus3.onap.org:10003" |
| 14 | IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}" |
| 15 | TIMESTAMP=$(date +"%Y%m%dT%H%M%S") |
| 16 | |
| 17 | if [ $HTTP_PROXY ]; then |
| 18 | BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}" |
| 19 | fi |
| 20 | if [ $HTTPS_PROXY ]; then |
| 21 | BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}" |
| 22 | fi |
| 23 | echo $BUILD_ARGS |
| 24 | |
| 25 | function build_image { |
| 26 | echo "Start build docker image: ${IMAGE_NAME}:latest" |
| 27 | docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:latest -f dockerfile . |
| 28 | } |
| 29 | |
| 30 | function push_image { |
| 31 | echo "Start push ${IMAGE_NAME}:latest" |
| 32 | docker push ${IMAGE_NAME}:latest |
| 33 | echo "Start push ${IMAGE_NAME}:${VERSION}-SNAPSHOT-latest" |
| 34 | docker tag ${IMAGE_NAME}:latest ${IMAGE_NAME}:${VERSION}-SNAPSHOT-latest |
| 35 | docker push ${IMAGE_NAME}:${VERSION}-SNAPSHOT-latest |
| 36 | } |
| 37 | |
| 38 | build_image |
| 39 | push_image |