3 # The script starts in the root folder of the repo, which has the following outline
4 # We fetch the version information from version.properties, build docker files and
5 # do a docker push. Since the job will be run under Jenkins, it will have the Nexus
10 # │ └── build_image.sh <--- THIS SCRIPT is here
15 # └── version.properties <--- Version information here
20 DOCKER_REPOSITORY=nexus3.onap.org:10003
23 IMAGE_NAME=$DOCKER_REPOSITORY/$ORG/$PROJECT
26 source version.properties
27 VERSION=$release_version
28 STAGING=${release_version}-STAGING
30 function log_ts() { # Log message with timestamp
31 echo [DEBUG LOG at $(date -u +%Y%m%d:%H%M%S)] "$@"
34 function build_image() {
35 log_ts Building Image in folder: $PWD
36 docker build -t ${IMAGE_NAME}:${VERSION} -t ${IMAGE_NAME}:latest -t ${IMAGE_NAME}:${STAGING} .
40 function push_image(){
41 log_ts Pushing images: ${IMAGE_NAME}:\{$VERSION,$STAGING,latest\}
42 docker push ${IMAGE_NAME}:${VERSION}
43 docker push ${IMAGE_NAME}:${STAGING}
44 docker push ${IMAGE_NAME}:latest
45 log_ts ... Pushed images