-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-build.sh
executable file
·38 lines (32 loc) · 958 Bytes
/
docker-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
#!/bin/bash
set -e -o pipefail
_list_sw () {
for f in Dockerfiles/Dockerfile.* ; do
OS=`basename "$f" | sed -e 's/^.*\.//'`
echo -en "OS $OS:\n\tSOFTWARE: "
for s in software/*/$OS.sh ; do echo $(basename $(dirname $s)) ; done | xargs
done
}
if [ $# -lt 2 ] ; then
echo "Usage: $0 OS SOFTWARE [..]"
echo ""
echo "Builds ./Dockerfiles/Dockerfile.OS and uses its container to run ./software/SOFTWARE/OS.sh"
echo ""
_list_sw
exit 1
fi
OS="$1"; shift
if [ ! -r "./Dockerfiles/Dockerfile.$OS" ] ; then
echo "$0: Error: './Dockerfiles/Dockerfile.$OS' does not exist"
exit 1
fi
set -x
docker build -t "$OS-build:latest" -f "./Dockerfiles/Dockerfile.$OS" .
for sw in "$@" ; do
if [ -x "./software/$sw/$OS.sh" ] ; then
./docker-run.sh "$OS" "$sw" /bin/bash -c "cd /build && ./$OS.sh"
else
echo "$0: Error: could not find './software/$sw/$OS.sh"
exit 1
fi
done