summaryrefslogtreecommitdiffstats
path: root/nokiav2/deployment/src/main
diff options
context:
space:
mode:
authorDenes Nemeth <denes.nemeth@nokia.com>2018-03-09 11:38:58 +0100
committerDenes Nemeth <denes.nemeth@nokia.com>2018-03-09 11:57:15 +0100
commitbf64f98a8d811ca59cb5d638b30971b1145411d2 (patch)
treefb8e66e29d7caa9cbfe1592625e5bb782c535242 /nokiav2/deployment/src/main
parente24a1b81a1e76d052be6d57995f18a1b7b7221ec (diff)
Remove maven during building docker images
Change-Id: Ic26230d8a5479704aa80f1b35e5cd36d556e7054 Signed-off-by: Denes Nemeth <denes.nemeth@nokia.com> Issue-ID: VFC-728
Diffstat (limited to 'nokiav2/deployment/src/main')
-rwxr-xr-xnokiav2/deployment/src/main/resources/Dockerfile9
-rwxr-xr-xnokiav2/deployment/src/main/resources/build_image.sh19
-rwxr-xr-xnokiav2/deployment/src/main/resources/test_xmlstarlet.sh7
3 files changed, 25 insertions, 10 deletions
diff --git a/nokiav2/deployment/src/main/resources/Dockerfile b/nokiav2/deployment/src/main/resources/Dockerfile
index e42f7b94..2ad7209c 100755
--- a/nokiav2/deployment/src/main/resources/Dockerfile
+++ b/nokiav2/deployment/src/main/resources/Dockerfile
@@ -1,17 +1,16 @@
FROM centos:7
WORKDIR /service
+ARG VERSION
COPY docker-entrypoint.sh .
COPY LICENSE ./ONAP_LICENSE
COPY application.properties .
-COPY driver.war .
-
RUN sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf
RUN sed -i 's|#baseurl=http://mirror.centos.org/centos|baseurl=http://mirrors.ocf.berkeley.edu/centos|' /etc/yum.repos.d/*.repo
RUN yum -y update
-RUN yum -y install java-1.8.0-openjdk-headless
+RUN yum -y install java-1.8.0-openjdk-headless wget
# Debugging tools withing the container
-RUN yum -y install mc vim tcpdump wget net-tools nc strace telnet unzip
-#RUN sed -i 's|#networkaddress.cache.ttl=-1|networkaddress.cache.ttl=10|' /usr/lib/jvm/jre/lib/security/java.security
+RUN yum -y install mc vim tcpdump net-tools nc strace telnet unzip xmlstarlet
+RUN wget -q -O driver.war "https://nexus.onap.org/service/local/artifact/maven/redirect?r=staging&g=org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2&a=driverwar&v=${VERSION}&e=war"
ENV JAVA_HOME /usr/lib/jvm/jre
RUN yum clean all
EXPOSE 8089
diff --git a/nokiav2/deployment/src/main/resources/build_image.sh b/nokiav2/deployment/src/main/resources/build_image.sh
index 24706f86..358048d8 100755
--- a/nokiav2/deployment/src/main/resources/build_image.sh
+++ b/nokiav2/deployment/src/main/resources/build_image.sh
@@ -17,34 +17,43 @@
if [ "a$1" != "abuildDocker" ] ; then
echo "Skipping building Docker image"
+ echo "If you would like to build the docker image by script execute $0 buildDocker"
+ echo "If you would like to build and push the docker image by script execute $0 buildDocker pushImage"
echo "If you would like to build the docker image by maven execute mvn package -Dexec.args=\"buildDocker\""
+ echo "If you would like to push the docker image by maven execute mvn package -Dexec.args=\"buildDocker pushImage\""
exit
fi
DIRNAME=`dirname $0`
DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd`
-echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}"
+echo "----- Build directory ${DOCKER_BUILD_DIR}"
cd ${DOCKER_BUILD_DIR}
-BUILD_ARGS="--no-cache --squash"
-ORG="onap"
-VERSION="1.1.0"
+VERSION=`xmlstarlet sel -t -v "/_:project/_:version" ../../../pom.xml | sed 's/-SNAPSHOT//g'`
+echo "------ Detected version: $VERSION"
+
PROJECT="vfc"
IMAGE="nfvo/svnfm/nokiav2"
DOCKER_REPOSITORY="nexus3.onap.org:10003"
+ORG="onap"
+BUILD_ARGS="--no-cache --squash"
IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
TIMESTAMP=$(date +"%Y%m%dT%H%M%S")
if [ $HTTP_PROXY ]; then
+ echo "----- Using HTTP proxy ${HTTP_PROXY}"
BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
fi
+
if [ $HTTPS_PROXY ]; then
+ echo "----- Using HTTPS proxy ${HTTPS_PROXY}"
BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
fi
function build_image {
echo "Start build docker image: ${IMAGE_NAME}"
- docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:latest .
+ echo "docker build --build-arg VERSION=${VERSION} ${BUILD_ARGS} -t ${IMAGE_NAME}:latest ."
+ docker build --build-arg VERSION=${VERSION} ${BUILD_ARGS} -t ${IMAGE_NAME}:latest .
}
function push_image_tag {
diff --git a/nokiav2/deployment/src/main/resources/test_xmlstarlet.sh b/nokiav2/deployment/src/main/resources/test_xmlstarlet.sh
new file mode 100755
index 00000000..f5ee03d3
--- /dev/null
+++ b/nokiav2/deployment/src/main/resources/test_xmlstarlet.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+DIRNAME=`dirname $0`
+BUILD_DIR=`cd $DIRNAME/; pwd`
+
+#If xmlstarlet is not present build will fail
+xmlstarlet ed ${BUILD_DIR}/../../../pom.xml