blob: 46685b6463051b0853b0c42f782b20f689584ff8 [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 {
Kiran Kamineni9b0c4942018-04-26 21:57:47 -070031 cp ../src/sms/auth/aaf_root_ca.cer .
Kiran Kamineni56a620d2018-04-26 17:31:07 -070032 cp ../src/sms/auth/aaf-sms.api.simpledemo.onap.org.pem .
33 cp ../src/sms/auth/aaf-sms.api.simpledemo.onap.org.pr .
34}
35
36function cleanup {
Kiran Kamineni468de912018-04-04 14:03:56 -070037 rm sms
Kiran Kamineni56a620d2018-04-26 17:31:07 -070038 rm aaf-sms.api.simpledemo.onap.org.pem
Kiran Kamineni9b0c4942018-04-26 21:57:47 -070039 rm aaf-sms.api.simpledemo.onap.org.pr
40 rm aaf_root_ca.cer
Kiran Kamineni468de912018-04-04 14:03:56 -070041}
42
43function build_image {
44 echo "Start build docker image: ${IMAGE_NAME}"
45 docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:latest -f smsdockerfile .
46}
47
48function push_image_tag {
49 TAG_NAME=$1
50 echo "Start push ${TAG_NAME}"
51 docker tag ${IMAGE_NAME}:latest ${TAG_NAME}
52 docker push ${TAG_NAME}
53}
54
55function push_image {
56 echo "Start push ${IMAGE_NAME}:latest"
57 docker push ${IMAGE_NAME}:latest
58
59 push_image_tag ${IMAGE_NAME}:${VERSION}-SNAPSHOT-latest
Kiran Kamineni468de912018-04-04 14:03:56 -070060}
61
62generate_binary
Kiran Kamineni56a620d2018-04-26 17:31:07 -070063copy_certificates
Kiran Kamineni468de912018-04-04 14:03:56 -070064build_image
65push_image
Kiran Kamineni9b0c4942018-04-26 21:57:47 -070066cleanup