1 #!/usr/bin/env /bin/bash
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}"
20 mvncmd=$(whereis mvn | grep ^mvn |awk '{print $2}')
22 if [[ 1$mvncmd != 1 ]]; then
26 elif [ $M2_HOME ]; then
27 mvncmd=$M2_HOME/bin/mvn
28 elif [ -f "/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn" ]; then
29 mvncmd="/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn"
30 elif [ -f "/usr/share/maven/bin/mvn" ]; then
31 mvncmd="/usr/share/maven/bin/mvn"
33 echo "Maven is not installed, mvncmd=$mvncmd"
38 #VERSION=$(printf 'VER\t${project.version}\n0'|$mvncmd help:evaluate)
39 #echo "0VERSION=${VERSION}"
40 VERSION=$(printf 'VER\t${project.version}'|$mvncmd help:evaluate|grep '^VER'|cut -f2)
41 echo "VERSION=${VERSION}"
43 cd ${DOCKER_BUILD_DIR}
44 if [[ $VERSION != *-SNAPSHOT ]]; then
45 NEXUSREPONAME="releases"
47 NEXUSREPONAME="snapshots"
49 echo "NEXUSREPONAME=${NEXUSREPONAME}"
51 if [ $HTTP_PROXY ]; then
52 BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}"
53 CURLPROXY="-x ${HTTP_PROXY}"
55 if [ $http_proxy ]; then
56 BUILD_ARGS+=" --build-arg HTTP_PROXY=${http_proxy}"
57 CURLPROXY="-x ${http_proxy}"
59 if [ $HTTPS_PROXY ]; then
60 BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
61 CURLPROXY="-x ${HTTS_PROXY}"
63 if [ $https_proxy ]; then
64 BUILD_ARGS+=" --build-arg HTTPS_PROXY=${https_proxy}"
65 CURLPROXY="-x ${https_proxy}"
67 echo "CURLPROXY=${CURLPROXY}"
69 rm -Rf activiti-5.2.0/
73 rm -Rf activiti-extension*.jar
74 rm -Rf activiti-rest.war
76 cp -Rf ./Dockerfile ./build
78 echo "download Tomcat 8.5.23"
79 #curl "${CURLPROXY}" -m 300 -O -J -L "http://mirrors.shuosc.org/apache/tomcat/tomcat-8/v8.5.20/bin/apache-tomcat-8.5.20.tar.gz"
80 wget "http://repo1.maven.org/maven2/org/apache/tomcat/tomcat/8.5.23/tomcat-8.5.23.tar.gz"
81 tar -zxf tomcat-8.5.23.tar.gz
82 mv apache-tomcat-8.5.23 ./build/apache-tomcat
84 echo "download Activiti 5.22.0"
85 wget "https://github.com/Activiti/Activiti/releases/download/activiti-5.22.0/activiti-5.22.0.zip"
86 #curl "${CURLPROXY}" -m 600 -O -J -L "https://github.com/Activiti/Activiti/releases/download/activiti-5.22.0/activiti-5.22.0.zip"
87 rm -Rf ./activiti-5.22.0/
88 #sudo apt-get install p7zip-full
89 #7za x activiti-5.22.0.zip
91 #unzip -o -q activiti-5.22.0.zip
92 unzip -o -q activiti-5.22.0.zip "activiti-5.22.0/wars/activiti-rest.war" -d ./
93 mv activiti-5.22.0/wars/activiti-rest.war .
95 echo "download activiti-extension ${VERSION}"
96 #curl "${CURLPROXY}" -m 600 -O -J -L "https://nexus.onap.org/service/local/artifact/maven/content?r=${NEXUSREPONAME}&g=org.onap.vfc.nfvo.wfengine&a=activiti-extension&e=jar&v=${VERSION}"
97 wget -O activiti-extension.jar "https://nexus.onap.org/service/local/artifact/maven/content?r=${NEXUSREPONAME}&g=org.onap.vfc.nfvo.wfengine&a=activiti-extension&e=jar&v=${VERSION}"
99 mkdir -p ./temp/WEB-INF/lib/
100 cp -f activiti-extension*.jar ./temp/WEB-INF/lib/activiti-extension.jar
102 echo "update activiti-rest.war"
103 jarcmd=$(whereis jar | grep ^jar |awk '{print $2}')
104 if [ 1$jarcmd != 1 ]; then
106 elif [ $JAVA_HOME ]; then
107 jarcmd=$JAVA_HOME/bin/jar
108 elif [ -f "/usr/lib/jvm/java-8-openjdk-amd64/bin/jar" ]; then
109 jarcmd="/usr/lib/jvm/java-8-openjdk-amd64/bin/jar"
113 echo "jarcmd=${jarcmd}"
114 $jarcmd -uvf activiti-rest.war -C ./temp/ ./
115 #. >/dev/null 2>&1 -C ./temp
116 cp activiti-rest.war ./build/apache-tomcat/webapps/
117 cp -Rf bin/* ./build/apache-tomcat/bin
119 function build_image {
120 echo "Start build docker image: ${IMAGE_NAME}"
121 docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:${VERSION} -t ${IMAGE_NAME}:latest ./build
124 function push_image {
125 echo "Start push docker image: ${IMAGE_NAME}"
126 docker push ${IMAGE_NAME}:${VERSION}
127 docker push ${IMAGE_NAME}:latest