3 echo '============== STARTING SCRIPT TO BUILD DOCKER IMAGES ================='
5 # JUST VERIFY ONLY - NO PUSHING
7 DOCKER_REPOSITORY=nexus3.onap.org:10003
8 MVN_VERSION=$(cat target/version)
9 MVN_MAJMIN_VERSION=$(cut -f 1,2 -d . target/version)
10 TIMESTAMP=$(date -u +%Y%m%dT%H%M%S)
13 if [ $HTTP_PROXY ]; then
14 PROXY_ARGS+="--build-arg HTTP_PROXY=${HTTP_PROXY}"
16 if [ $HTTPS_PROXY ]; then
17 PROXY_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}"
20 echo $DOCKER_REPOSITORY
22 echo $MVN_MAJMIN_VERSION
25 if [[ -z $MVN_VERSION ]]
27 echo "MVN_VERSION is empty"
31 if [[ -z $MVN_MAJMIN_VERSION ]]
33 echo "MVN_MAJMIN_VERSION is empty"
37 if [[ $MVN_VERSION == *"SNAPSHOT"* ]]
39 MVN_MAJMIN_VERSION="${MVN_MAJMIN_VERSION}-SNAPSHOT"
41 MVN_MAJMIN_VERSION="${MVN_MAJMIN_VERSION}-STAGING"
44 echo $MVN_MAJMIN_VERSION
46 cp policy-pe/* target/policy-pe/
47 cp policy-drools/* target/policy-drools/
49 for image in policy-os policy-nexus policy-db policy-base policy-drools policy-pe ; do
50 echo "Building $image"
51 mkdir -p target/$image
52 cp $image/* target/$image
55 # This is the local latest tagged image. The Dockerfile's need this to build images
57 TAGS="--tag onap/policy/${image}:latest"
59 # This has the nexus repo prepended and only major/minor version with latest
61 TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${image}:${MVN_MAJMIN_VERSION}-latest"
63 # This has the nexus repo prepended and major/minor/patch version with timestamp
65 TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/onap/policy/${image}:${MVN_VERSION}-${TIMESTAMP}"
69 docker build --quiet ${PROXY_ARGS} $TAGS target/$image
73 echo "Docker build failed"