summaryrefslogtreecommitdiffstats
path: root/deployment/docker-build.sh
diff options
context:
space:
mode:
authorShashank Kumar Shankar <shashank.kumar.shankar@intel.com>2018-03-15 15:21:15 -0700
committerShashank Kumar Shankar <shashank.kumar.shankar@intel.com>2018-03-16 16:24:27 -0700
commit1f99187b2ec49a132bd82b40bc4cd02d79cbd416 (patch)
treebc8d9cabc08f75be66139b85f9561b1066c89dc3 /deployment/docker-build.sh
parentb1be54648978a1c858d2ce1e0701e0552c9296fe (diff)
Add Docker push to nexus support
This patch adds support to push built docker container to Nexus. Change-Id: I9c9d3c01c548c0d3dcfec70f299765f0221379dc Issue-ID: MUSIC-59 Signed-off-by: Shashank Kumar Shankar <shashank.kumar.shankar@intel.com>
Diffstat (limited to 'deployment/docker-build.sh')
-rwxr-xr-xdeployment/docker-build.sh36
1 files changed, 34 insertions, 2 deletions
diff --git a/deployment/docker-build.sh b/deployment/docker-build.sh
index 767554f..50a2a89 100755
--- a/deployment/docker-build.sh
+++ b/deployment/docker-build.sh
@@ -1,5 +1,14 @@
#!/bin/bash
+BUILD_ARGS="--no-cache"
+ORG="onap"
+VERSION="1.0.0"
+PROJECT="music"
+IMAGE="distributed-kv-store"
+DOCKER_REPOSITORY="nexus3.onap.org:10003"
+IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
+TIMESTAMP=$(date +"%Y%m%dT%H%M%S")
+
if [ $HTTP_PROXY ]; then
BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
fi
@@ -7,5 +16,28 @@ if [ $HTTPS_PROXY ]; then
BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
fi
-echo "Start build docker image"
-docker build ${BUILD_ARGS} -t dkv .
+function generate_binary {
+ pushd ../src/dkv
+ make build
+ popd
+ cp ../target/dkv .
+}
+
+function build_image {
+ echo "Start build docker image."
+ docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:latest .
+}
+
+function push_image {
+ echo "Start push docker image."
+ docker push ${IMAGE_NAME}:latest
+}
+
+function remove_binary {
+ rm dkv
+}
+
+generate_binary
+build_image
+push_image
+remove_binary