4 DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd`
5 echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}"
8 BUILD_ARGS="--no-cache"
11 VERSION="1.0.0-SNAPSHOT"
13 IMAGE="wfengine-activiti"
14 DOCKER_REPOSITORY="nexus3.onap.org:10003"
15 IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
17 if [ -z $NEXUS_REPOS_URL ]; then
18 NEXUS_REPOS_URL="https://nexus.onap.org"
24 mvncmd=$(whereis mvn | grep ^mvn |awk '{print $2}')
25 if [[ 1$mvncmd != 1 ]]; then
30 elif [ $M2_HOME ]; then
32 mvncmd=$M2_HOME/bin/mvn
33 elif [ -f "/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn" ]; then
34 echo /w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn
35 mvncmd="/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn"
36 elif [ -f "/usr/share/maven/bin/mvn" ]; then
37 mvncmd="/usr/share/maven/bin/mvn"
39 echo "Maven is not installed, mvncmd=$mvncmd"
42 echo "mvncmd=${mvncmd}"
45 #VERSION=$(printf 'VER\t${project.version}\n0'|$mvncmd help:evaluate)
46 #echo "0VERSION=${VERSION}"
47 VERSION=$(printf 'VER\t${project.version}'|$mvncmd help:evaluate|grep '^VER'|cut -f2)
48 echo "VERSION=${VERSION}"
50 cd ${DOCKER_BUILD_DIR}
51 if [[ $VERSION != *-SNAPSHOT ]]; then
52 NEXUSREPONAME="releases"
54 NEXUSREPONAME="snapshots"
56 echo "NEXUSREPONAME=${NEXUSREPONAME}"
58 if [ $HTTP_PROXY ]; then
59 BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
60 CURLPROXY="-x ${HTTP_PROXY}"
62 if [ $http_proxy ]; then
63 BUILD_ARGS+=" --build-arg HTTP_PROXY=${http_proxy}"
64 CURLPROXY="-x ${http_proxy}"
66 if [ $HTTPS_PROXY ]; then
67 BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
68 CURLPROXY="-x ${HTTS_PROXY}"
70 if [ $https_proxy ]; then
71 BUILD_ARGS+=" --build-arg HTTPS_PROXY=${https_proxy}"
72 CURLPROXY="-x ${https_proxy}"
74 echo "CURLPROXY=${CURLPROXY}"
76 rm -Rf activiti-5.2.0/
80 rm -Rf activiti-extension*.jar
81 rm -Rf activiti-rest.war
83 cp -Rf ./Dockerfile ./build
85 echo "download Tomcat 8.5.23"
86 #curl "${CURLPROXY}" -m 300 -O -J -L "${NEXUS_REPOS_URL}/content/repositories/central/org/apache/tomcat/tomcat/8.5.23/tomcat-8.5.23.tar.gz"
87 wget "${NEXUS_REPOS_URL}/content/repositories/central/org/apache/tomcat/tomcat/8.5.23/tomcat-8.5.23.tar.gz"
88 tar -zxf tomcat-8.5.23.tar.gz
89 mv apache-tomcat-8.5.23 ./build/apache-tomcat
91 echo "download Activiti 5.22.0"
92 wget "https://github.com/Activiti/Activiti/releases/download/activiti-5.22.0/activiti-5.22.0.zip"
93 #curl "${CURLPROXY}" -m 600 -O -J -L "https://github.com/Activiti/Activiti/releases/download/activiti-5.22.0/activiti-5.22.0.zip"
94 rm -Rf ./activiti-5.22.0/
95 #sudo apt-get install p7zip-full
96 #7za x activiti-5.22.0.zip
98 #unzip -o -q activiti-5.22.0.zip
99 unzip -o -q activiti-5.22.0.zip "activiti-5.22.0/wars/activiti-rest.war" -d ./
100 mv activiti-5.22.0/wars/activiti-rest.war .
102 echo "download activiti-extension ${VERSION}"
103 #curl "${CURLPROXY}" -m 600 -O -J -L "${NEXUS_REPOS_URL}/service/local/artifact/maven/content?r=${NEXUSREPONAME}&g=org.onap.vfc.nfvo.wfengine&a=activiti-extension&e=jar&v=${VERSION}"
104 wget -O activiti-extension.jar "${NEXUS_REPOS_URL}/service/local/artifact/maven/content?r=${NEXUSREPONAME}&g=org.onap.vfc.nfvo.wfengine&a=activiti-extension&e=jar&v=${VERSION}"
106 mkdir -p ./temp/WEB-INF/lib/
107 cp -f activiti-extension*.jar ./temp/WEB-INF/lib/activiti-extension.jar
109 echo "update activiti-rest.war"
110 jarcmd=$(whereis jar | grep ^jar |awk '{print $2}')
111 if [ 1$jarcmd != 1 ]; then
113 elif [ $JAVA_HOME ]; then
114 if [ -f "$JAVA_HOME/bin/jar"]; then
115 jarcmd=$JAVA_HOME/bin/jar
116 elif [ -f "$JAVA_HOME/../bin/jar"]; then
117 jarcmd=$JAVA_HOME/../bin/jar
119 echo "Jar is not installed, JAVA_HOME=$JAVA_HOME"
122 elif [ -f "/usr/lib/jvm/java-8-openjdk-amd64/bin/jar" ]; then
123 jarcmd="/usr/lib/jvm/java-8-openjdk-amd64/bin/jar"
124 elif [ -f "/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/jar" ]; then
125 jarcmd="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/jar"
127 echo "Jar is not installed, jarcmd=$jarcmd"
130 echo "jarcmd=${jarcmd}"
132 $jarcmd -uvf activiti-rest.war -C ./temp/ ./
133 #. >/dev/null 2>&1 -C ./temp
134 cp activiti-rest.war ./build/apache-tomcat/webapps/
135 cp -Rf bin/* ./build/apache-tomcat/bin
137 function build_image {
138 echo "Start build docker image: ${IMAGE_NAME}"
139 docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:${VERSION} -t ${IMAGE_NAME}:latest ./build
142 function push_image {
143 echo "Start push docker image: ${IMAGE_NAME}"
144 docker push ${IMAGE_NAME}:${VERSION}
145 docker push ${IMAGE_NAME}:latest