blob: e096f8ce53e859cd2aca2382ef7eb4f3a052e0ab [file] [log] [blame]
Manjunath Ranganathaiahb4133b72018-08-23 15:30:53 -07001#!/bin/bash
2set -e
3DIRNAME=`dirname $0`
4DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd`
5echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}"
6cd ${DOCKER_BUILD_DIR}
7
8BUILD_ARGS="--no-cache"
9ORG="onap"
10VERSION="3.0.0"
11PROJECT="aaf"
12IMAGE="abrmd"
13DOCKER_REPOSITORY="nexus3.onap.org:10003"
14IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
15TIMESTAMP=$(date +"%Y%m%dT%H%M%S")
16
17if [ $HTTP_PROXY ]; then
18 BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
19fi
20if [ $HTTPS_PROXY ]; then
21 BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
22fi
23echo $BUILD_ARGS
24
25function build_image {
26 echo "Start build docker image: ${IMAGE_NAME}:latest"
27 docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:latest -f dockerfile .
28}
29
30function 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
38build_image
39push_image