Image build and push scripts
[ealt-edge.git] / mecm / mepm / applcm / broker / build_push_image.sh
1 #!/bin/bash
2 # Copyright 2020 Huawei Technologies Co., Ltd.
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 unset REPO_USER
17 unset REPO_PWD
18 echo -n "REPO_USER:"
19 read REPO_USER
20 echo -n "REPO_PWD:"
21 read REPO_PWD
22
23 DOCKER_BUILD_DIR=`pwd`
24 MECM_VERSION=latest
25 IMAGE_NAME=applcm-broker
26 REPO_NAME=ealtedge
27
28 echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}"
29 echo "In Build and Push Broker"
30
31 function build_image {
32     docker build --no-cache -t ${REPO_NAME}/${IMAGE_NAME}:${MECM_VERSION} -f build/Dockerfile .
33 }
34
35 function push_image {
36     docker login -u ${REPO_USER} -p ${REPO_PWD}
37     docker push ${REPO_NAME}/${IMAGE_NAME}:${MECM_VERSION}
38 }
39
40 build_image
41 push_image