Bump up patch version after release 1.5.1
[multicloud/framework.git] / artifactbroker / packages / docker / build_image.sh
1 #!/bin/bash
2 # Copyright (c) 2017-2018 VMware, Inc.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
13 DIRNAME=`dirname $0`
14 DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd`
15 echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}"
16 cd ${DOCKER_BUILD_DIR}
17
18 BUILD_ARGS="--no-cache"
19 ORG="onap"
20 VERSION="1.5.2-SNAPSHOT"
21 STAGING_VERSION="1.5.2-STAGING"
22 PROJECT="multicloud"
23 IMAGE="framework-artifactbroker"
24 DOCKER_REPOSITORY="nexus3.onap.org:10003"
25 IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
26
27 if [ $HTTP_PROXY ]; then
28     BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
29 fi
30 if [ $HTTPS_PROXY ]; then
31     BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
32 fi
33
34 function build_image {
35     docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:${VERSION} -t ${IMAGE_NAME}:latest -t ${IMAGE_NAME}:${STAGING_VERSION} .
36 }
37
38 function push_image {
39     docker push ${IMAGE_NAME}:${VERSION}
40     docker push ${IMAGE_NAME}:${STAGING_VERSION}
41     docker push ${IMAGE_NAME}:latest
42 }
43
44 build_image
45 push_image