Ethan Lynn | c763387 | 2017-08-28 16:45:26 +0800 | [diff] [blame] | 1 | #!/bin/bash |
Ethan Lynn | b1940de | 2017-09-07 17:48:06 +0800 | [diff] [blame^] | 2 | DIRNAME=`dirname $0` |
| 3 | DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd` |
| 4 | echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}" |
| 5 | cd ${DOCKER_BUILD_DIR} |
Ethan Lynn | c763387 | 2017-08-28 16:45:26 +0800 | [diff] [blame] | 6 | |
Ethan Lynn | b1940de | 2017-09-07 17:48:06 +0800 | [diff] [blame^] | 7 | BUILD_ARGS="--no-cache" |
| 8 | ORG="onap" |
| 9 | VERSION="1.0.0-SNAPSHOT" |
| 10 | PROJECT="multicloud" |
| 11 | IMAGE="framework" |
| 12 | DOCKER_REPOSITORY="nexus3.onap.org:10003" |
| 13 | IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}" |
Ethan Lynn | c763387 | 2017-08-28 16:45:26 +0800 | [diff] [blame] | 14 | |
Ethan Lynn | b1940de | 2017-09-07 17:48:06 +0800 | [diff] [blame^] | 15 | if [ $HTTP_PROXY ]; then |
| 16 | BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}" |
| 17 | fi |
| 18 | if [ $HTTPS_PROXY ]; then |
| 19 | BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}" |
| 20 | fi |
| 21 | |
| 22 | function build_image { |
| 23 | docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:${VERSION} -t ${IMAGE_NAME}:latest . |
| 24 | } |
| 25 | |
| 26 | function push_image { |
| 27 | docker push ${IMAGE_NAME}:${VERSION} |
| 28 | docker push ${IMAGE_NAME}:latest |
| 29 | } |
| 30 | |
| 31 | build_image |
| 32 | push_image |