-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
67 lines (52 loc) · 1.05 KB
/
Copy pathrun.sh
File metadata and controls
67 lines (52 loc) · 1.05 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
DIR=`basename $0`
START_DIR=`pwd`
usage() {
echo Usage:
echo $0 project
}
if [[ $# -lt 1 ]]; then
usage
exit 1
fi
PROJECT=$1
PROJECT_DIR=$DIR/$PROJECT
BUILD=$PROJECT_DIR/build
$CONFIG=$PROJECT_DIR/config
if [[ ! -e $CONFIG ]]; then
echo "${PROJECT} config does not exist"
exit 1
fi
source $CONFIG
if [[ -n "$DEPENDS" ]]; then
echo Checking to see if the $DEPENDS is in docker cache
# local image
echo " local"
LOCAL=`docker images|grep $DEPENDS`
if [[ -z "$LOCAL" ]]; then
# main repository
echo " main"
MAIN=`docker search ${DEPENDS}|grep ${DEPENDS}`
if [[ -z "$MAIN" ]]; then
echo Building Dependency: ${DEPENDS}
$0 $DEPENDS
if [[ $? -ne 0 ]]; then
echo Aborting
exit 2
fi
fi
fi
fi
echo "Pulling git repository"
git pull $REPO_URL $BUILD
echo "Copying Dockerfile"
cp ${PROJECT_DIR}/Dockerfile $BUILD
cd $BUILD
echo "Building Container"
docker build -t $PROJECT .
if [[ $? -ne 0 ]]; then
echo "An Error Occurred, Aborting"
cd $START_DIR
exit 1
fi
cd $START_DIR