-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.sh
executable file
·54 lines (42 loc) · 1.15 KB
/
build.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
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
BASE_FOLDER=base
CURRENT_PATH=$(pwd)
# Function to build images (without version tags) for folders where the Dockerfile is at the top level.
# This is the case for the base and languages for which only a single version is supported.
# Any image that differs from it should have its on build script.
build_generic() {
FOLDER=$1
cd $FOLDER
REGISTRY=coursemology
IMAGE_NAME=$REGISTRY/evaluator-image-$FOLDER
echo "IN $(pwd)"
echo "Building $IMAGE_NAME"
docker build -t $IMAGE_NAME .
cd $CURRENT_PATH
}
build() {
# Look for build.sh in the folder, if it doesn't exist use the generic build method.
FOLDER=$1
NEXT_PATH=$CURRENT_PATH/$FOLDER
if [ -f $NEXT_PATH/build.sh ]; then
cd $NEXT_PATH
bash build.sh
cd $CURRENT_PATH
else
build_generic $FOLDER
fi
}
# Build the base docker image first.
build $BASE_FOLDER
for f in $(pwd)/*;
do
if [ ! -d $f ]; then
continue
fi
FOLDER_NAME=`basename $f`
# This is the folder with the Dockerfile for the base image. Skip it since it has already been built
if [ $FOLDER_NAME == $BASE_FOLDER ]; then
continue
fi
build $FOLDER_NAME
done;