blob: 3c9be833a94d89f9e11a459505637382d454b742 [file] [log] [blame]
Pamela Dragoshb1743392017-02-21 12:04:28 -05001#!/bin/bash
2#
3echo '============== STARTING SCRIPT TO BUILD DOCKER IMAGES ================='
Pamela Dragoshceba3d82017-03-16 11:02:05 -04004#
5# JUST VERIFY ONLY - NO PUSHING
6#
Pamela Dragoshb1743392017-02-21 12:04:28 -05007DOCKER_REPOSITORY=nexus3.openecomp.org:10003
Pamela Dragosh3fe4d9c2017-03-07 15:39:48 -05008MVN_VERSION=$(cat target/version)
Pamela Dragoshe9f737a2017-03-23 07:44:56 -04009MVN_MAJMIN_VERSION=$(cut -f 1,2 -d . target/version)
Pamela Dragosh3fe4d9c2017-03-07 15:39:48 -050010TIMESTAMP=$(date -u +%Y%m%dT%H%M%S)
Pamela Dragoshb1743392017-02-21 12:04:28 -050011
Pamela Dragosh3fe4d9c2017-03-07 15:39:48 -050012echo $DOCKER_REPOSITORY
13echo $MVN_VERSION
Pamela Dragoshe9f737a2017-03-23 07:44:56 -040014echo $MVN_MAJMIN_VERSION
Pamela Dragosh3fe4d9c2017-03-07 15:39:48 -050015echo $TIMESTAMP
Pamela Dragosh6f91e0b2017-02-23 10:37:49 -050016
Pamela Dragoshe9f737a2017-03-23 07:44:56 -040017if [[ -z $MVN_VERSION ]]
18then
19 echo "MVN_VERSION is empty"
20 exit 1
21fi
22
23if [[ -z $MVN_MAJMIN_VERSION ]]
24then
25 echo "MVN_MAJMIN_VERSION is empty"
26 exit 1
27fi
28
29if [[ $MVN_VERSION == *"SNAPSHOT"* ]]
30then
31 MVN_MAJMIN_VERSION="${MVN_MAJMIN_VERSION}-SNAPSHOT"
32else
33 MVN_MAJMIN_VERSION="${MVN_MAJMIN_VERSION}-STAGING"
34fi
35
36echo $MVN_MAJMIN_VERSION
37
Pamela Dragosh6f91e0b2017-02-23 10:37:49 -050038cp policy-pe/* target/policy-pe/
39cp policy-drools/* target/policy-drools/
40
41for image in policy-os policy-nexus policy-db policy-base policy-drools policy-pe ; do
42 echo "Building $image"
43 mkdir -p target/$image
44 cp $image/* target/$image
Pamela Dragosh3fe4d9c2017-03-07 15:39:48 -050045
Pamela Dragoshe9f737a2017-03-23 07:44:56 -040046 #
47 # This is the local latest tagged image. The Dockerfile's need this to build images
48 #
Pamela Dragosh3fe4d9c2017-03-07 15:39:48 -050049 TAGS="--tag openecomp/policy/${image}:latest"
Pamela Dragoshe9f737a2017-03-23 07:44:56 -040050 #
51 # This has the nexus repo prepended and only major/minor version with latest
52 #
53 TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/openecomp/policy/${image}:${MVN_MAJMIN_VERSION}-latest"
54 #
55 # This has the nexus repo prepended and major/minor/patch version with timestamp
56 #
Pamela Dragosh3fe4d9c2017-03-07 15:39:48 -050057 TAGS="${TAGS} --tag ${DOCKER_REPOSITORY}/openecomp/policy/${image}:${MVN_VERSION}-${TIMESTAMP}"
58
59 echo $TAGS
Pamela Dragosh3311eb72017-03-16 11:30:29 -040060
61 docker build --quiet $TAGS target/$image
Pamela Dragosh6f91e0b2017-02-23 10:37:49 -050062done
Pamela Dragosh3311eb72017-03-16 11:30:29 -040063
64docker images
65