-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.sh
executable file
·42 lines (33 loc) · 941 Bytes
/
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
#!/usr/bin/env bash
ERROR_PREFIX="ERROR:"
DIRECTORY=$1
REPO_ROOT=`pwd`
# TODO add usage and error that no arguments specified
if [ ! -d "$DIRECTORY" ]; then
echo "${ERROR_PREFIX} Directory '${DIRECTORY}' doesn't exist. Aborting'" >&2
exit 1
fi
echo "Entering directory: ${DIRECTORY}"
cd $DIRECTORY
if [ ! -f Dockerfile ]; then
echo "${ERROR_PREFIX} No Dockerfile found. Aborting." >&2
exit 2
fi
image_tag="cig2017_`basename $DIRECTORY`"
container_name=${image_tag}
if [ ! -f ${REPO_ROOT}/cig2017.wad ]; then
echo "${ERROR_PREFIX} cig2017.wad not found. Aborting." >&2
exit 3
fi
if [ ! -f ${REPO_ROOT}/_vizdoom.cfg ]; then
echo "${ERROR_PREFIX} _vizdoom.cfg not found. Aborting." >&2
exit 4
fi
echo ${REPO_ROOT}
cp ${REPO_ROOT}/cig2017.wad .
cp ${REPO_ROOT}/_vizdoom.cfg .
if [ -f ${REPO_ROOT}/doom2.wad ]; then
cp ${REPO_ROOT}/doom2.wad .
fi
docker build -t ${image_tag} .
rm -f cig2017.wad _vizdoom.cfg doom2.wad