forked from Informasjonsforvaltning/fdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildOrPullApplication.sh
executable file
·43 lines (34 loc) · 1.21 KB
/
buildOrPullApplication.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
set -e
BUILD_APP=$1
BUILD_CMD=$2
SECONDS=0 # start timer
echo "----------------------------------"
echo "Starting build of application $BUILD_APP"
echo "----------------------------------"
# skip build if all application images are already in dockerhub
buildtag=$(./citools/getBuildTag.sh $BUILD_APP)
if [ "$FORCE_BUILD" != "true" ]
then
echo "Checking if applications image is already built and tagged with $buildtag"
if ./citools/applicationsTagExistInDockerHub.sh $BUILD_APP $buildtag
then
echo "----------------------------------"
echo "Skipping build of application"
echo "Build image with tag $buildtag is already in dockerhub for application $BUILD_APP"
echo "----------------------------------"
echo "Pulling image with tag $buildtag"
./citools/pullApplicationsByTag.sh $BUILD_APP $buildtag
# tag the downloaded images as latest to allow docker-compose to use them
./citools/retagApplications.sh $BUILD_APP $buildtag latest
echo "SECONDS"
echo $SECONDS
exit 0
fi
fi
#build
echo "Launching group build command"
eval $BUILD_CMD
echo "Done build of application $BUILD_APP"
echo "SECONDS"
echo $SECONDS