blob: 227678bba2d1e0d11f98414c9425ef100f83a415 [file] [log] [blame]
Kiran Kamineni468de912018-04-04 14:03:56 -07001#!/bin/bash
Kiran Kaminenic351f2e2018-06-05 17:19:12 -07002set -e
Kiran Kamineni468de912018-04-04 14:03:56 -07003DIRNAME=`dirname $0`
4DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd`
5echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}"
6cd ${DOCKER_BUILD_DIR}
7
8BUILD_ARGS="--no-cache"
9ORG="onap"
Manjunath Ranganathaiahc0b515d2019-04-10 10:57:46 -070010VERSION="4.0.0"
Kiran Kamineni468de912018-04-04 14:03:56 -070011PROJECT="aaf"
Kiran Kaminenic4150672018-04-05 11:54:20 -070012IMAGE="smsquorumclient"
Kiran Kamineni468de912018-04-04 14:03:56 -070013DOCKER_REPOSITORY="nexus3.onap.org:10003"
14IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
15TIMESTAMP=$(date +"%Y%m%dT%H%M%S")
16
17if [ $HTTP_PROXY ]; then
18 BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
19fi
20if [ $HTTPS_PROXY ]; then
21 BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
22fi
23#Need to create makefile
24function generate_binary {
Kiran Kaminenic4150672018-04-05 11:54:20 -070025 pushd ../src/quorumclient
Kiran Kamineni468de912018-04-04 14:03:56 -070026 make build
27 popd
28 cp ../target/quorumclient .
29}
30
Kiran Kamineni56a620d2018-04-26 17:31:07 -070031function copy_certificates {
Kiran Kamineni30cd3842018-05-14 14:40:03 -070032 cp ../src/sms/certs/aaf_root_ca.cer .
Kiran Kamineni56a620d2018-04-26 17:31:07 -070033}
34
35function cleanup {
Kiran Kamineni468de912018-04-04 14:03:56 -070036 rm quorumclient
Kiran Kamineni56a620d2018-04-26 17:31:07 -070037 rm aaf_root_ca.cer
Kiran Kamineni468de912018-04-04 14:03:56 -070038}
39
40function build_image {
41 echo "Start build docker image: ${IMAGE_NAME}"
42 docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:latest -f quorumdockerfile .
43}
44
45function push_image_tag {
46 TAG_NAME=$1
47 echo "Start push ${TAG_NAME}"
48 docker tag ${IMAGE_NAME}:latest ${TAG_NAME}
49 docker push ${TAG_NAME}
50}
51
52function push_image {
53 echo "Start push ${IMAGE_NAME}:latest"
54 docker push ${IMAGE_NAME}:latest
55
56 push_image_tag ${IMAGE_NAME}:${VERSION}-SNAPSHOT-latest
Kiran Kamineni468de912018-04-04 14:03:56 -070057}
58
59generate_binary
Kiran Kamineni56a620d2018-04-26 17:31:07 -070060copy_certificates
Kiran Kamineni468de912018-04-04 14:03:56 -070061build_image
62push_image
Kiran Kamineniccacdc32018-10-30 14:27:18 -070063cleanup