blob: a6559d4c5c6e47121b67277cb03717d4437b2dce [file] [log] [blame]
Ethan Lynnc7633872017-08-28 16:45:26 +08001#!/bin/bash
Ethan Lynn2906f882018-01-15 10:32:43 +08002# 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
Ethan Lynnb1940de2017-09-07 17:48:06 +080013DIRNAME=`dirname $0`
14DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd`
15echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}"
16cd ${DOCKER_BUILD_DIR}
Ethan Lynnc7633872017-08-28 16:45:26 +080017
Ethan Lynnb1940de2017-09-07 17:48:06 +080018BUILD_ARGS="--no-cache"
19ORG="onap"
Bin Yang55520842021-09-13 15:34:03 +080020VERSION="1.7.2-SNAPSHOT"
21STAGING_VERSION="1.7.2-STAGING"
Ethan Lynnb1940de2017-09-07 17:48:06 +080022PROJECT="multicloud"
23IMAGE="framework"
24DOCKER_REPOSITORY="nexus3.onap.org:10003"
25IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
Ethan Lynnc7633872017-08-28 16:45:26 +080026
Ethan Lynnb1940de2017-09-07 17:48:06 +080027if [ $HTTP_PROXY ]; then
28 BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
29fi
30if [ $HTTPS_PROXY ]; then
31 BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
32fi
33
34function build_image {
Ethan Lynn4d52f6e2017-10-12 17:18:08 +080035 docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:${VERSION} -t ${IMAGE_NAME}:latest -t ${IMAGE_NAME}:${STAGING_VERSION} .
Ethan Lynnb1940de2017-09-07 17:48:06 +080036}
37
38function push_image {
39 docker push ${IMAGE_NAME}:${VERSION}
Ethan Lynn4d52f6e2017-10-12 17:18:08 +080040 docker push ${IMAGE_NAME}:${STAGING_VERSION}
Ethan Lynnb1940de2017-09-07 17:48:06 +080041 docker push ${IMAGE_NAME}:latest
42}
43
44build_image
liangke72d43b42018-05-02 13:56:29 +080045push_image