Bump up patch version after releasing images
[multicloud/azure.git] / azure / docker / build_image.sh
1 #!/bin/bash
2 # Copyright (c) 2018 Amdocs
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 #
8 #         http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 DIRNAME=`dirname $0`
17 DOCKER_BUILD_DIR=`cd $DIRNAME/../; pwd`
18 echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}"
19 cd ${DOCKER_BUILD_DIR}
20
21 BUILD_ARGS="--no-cache"
22 ORG="onap"
23 VERSION="1.2.3-SNAPSHOT"
24 STAGING="1.2.3-STAGING"
25 PROJECT="multicloud"
26 IMAGE="azure"
27 DOCKER_REPOSITORY="nexus3.onap.org:10003"
28 IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
29
30 if [ $HTTP_PROXY ]; then
31     BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
32 fi
33 if [ $HTTPS_PROXY ]; then
34     BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
35 fi
36
37 function build_image {
38     echo "Start build docker image: ${IMAGE_NAME}"
39     docker build ${BUILD_ARGS} -f docker/Dockerfile -t ${IMAGE_NAME}:${VERSION} -t ${IMAGE_NAME}:latest -t ${IMAGE_NAME}:${STAGING} .
40 }
41
42 function push_image {
43     echo "Start push docker image: ${IMAGE_NAME}"
44     docker push ${IMAGE_NAME}:${VERSION}
45     docker push ${IMAGE_NAME}:latest
46     docker push ${IMAGE_NAME}:${STAGING}
47
48
49 build_image
50 push_image