blob: cd3663f13d5954ce346acd4742906cf7e1f5ba61 [file] [log] [blame]
Kiran Kamineni468de912018-04-04 14:03:56 -07001#!/bin/bash
2DIRNAME=`dirname $0`
3DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd`
4echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}"
5cd ${DOCKER_BUILD_DIR}
6
7BUILD_ARGS="--no-cache"
8ORG="onap"
Kiran Kamineni74d37f12018-04-24 16:28:44 -07009VERSION="2.0.0"
Kiran Kamineni468de912018-04-04 14:03:56 -070010PROJECT="aaf"
11IMAGE="sms"
12DOCKER_REPOSITORY="nexus3.onap.org:10003"
13IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
14TIMESTAMP=$(date +"%Y%m%dT%H%M%S")
15
16if [ $HTTP_PROXY ]; then
17 BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
18fi
19if [ $HTTPS_PROXY ]; then
20 BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
21fi
22
23function generate_binary {
24 pushd ../src/sms
25 make build
26 popd
27 cp ../target/sms .
28}
29
Kiran Kamineni56a620d2018-04-26 17:31:07 -070030function copy_certificates {
31 cp ../src/sms/auth/aaf-sms.api.simpledemo.onap.org.pem .
32 cp ../src/sms/auth/aaf-sms.api.simpledemo.onap.org.pr .
33}
34
35function cleanup {
Kiran Kamineni468de912018-04-04 14:03:56 -070036 rm sms
Kiran Kamineni56a620d2018-04-26 17:31:07 -070037 rm aaf-sms.api.simpledemo.onap.org.pem
38 rm af-sms.api.simpledemo.onap.org.pr
Kiran Kamineni468de912018-04-04 14:03:56 -070039}
40
41function build_image {
42 echo "Start build docker image: ${IMAGE_NAME}"
43 docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:latest -f smsdockerfile .
44}
45
46function push_image_tag {
47 TAG_NAME=$1
48 echo "Start push ${TAG_NAME}"
49 docker tag ${IMAGE_NAME}:latest ${TAG_NAME}
50 docker push ${TAG_NAME}
51}
52
53function push_image {
54 echo "Start push ${IMAGE_NAME}:latest"
55 docker push ${IMAGE_NAME}:latest
56
57 push_image_tag ${IMAGE_NAME}:${VERSION}-SNAPSHOT-latest
Kiran Kamineni468de912018-04-04 14:03:56 -070058}
59
60generate_binary
Kiran Kamineni56a620d2018-04-26 17:31:07 -070061copy_certificates
Kiran Kamineni468de912018-04-04 14:03:56 -070062build_image
63push_image
Kiran Kamineni56a620d2018-04-26 17:31:07 -070064cleanup