forked from anup-kodlekere/gaplib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-selfhosted.sh
executable file
·62 lines (61 loc) · 1.47 KB
/
build-selfhosted.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
55
56
57
58
59
60
61
62
#!/bin/bash
usage() {
echo "Usage: build-standalone.sh [flags] [ubuntu|almalinux]"
echo
echo "Where flags:"
echo "-b [docker|podman] Image build tool to use - defaults to which it finds first"
echo "-s <sdk> SDK to use (6 or 7 ...). Default 6 for s390x and 7 for ppc64le"
echo "-h Display this usage information"
echo
echo "If no distribution is specified then images for both are built"
exit
}
ARCH=`uname -m`
DISTROS=""
BUILDER=`which podman 2>/dev/null`
if [ -z ${BUILDER} ]; then
BUILDER=`which docker 2>/dev/null`
fi
if [ -z ${BUILDER} ]; then
echo "Need podman or docker installed" >&2
exit 1
fi
while getopts "b:hs:" opt
do
case "${opt}" in
b)
BUILDER="${OPTARG}"
;;
h)
usage
;;
s)
SDK="${OPTARG}"
;;
esac
done
shift $(( OPTIND - 1 ))
if [ -z "$@" ]; then
DISTROS="ubuntu almalinux opensuse"
else
DISTROS=$@
fi
if [ -z "${SDK}" ]; then
case ${ARCH} in
ppc64le)
SDK=7
;;
s390x)
SDK=6
;;
esac
fi
for dist in ${DISTROS}
do
if [ ! -f Dockerfile.${dist} ]; then
echo "${dist} not supported" >&2
else
${BUILDER} build -f Dockerfile.${dist} --build-arg RUNNERPATCH=build-files/runner-${ARCH}.patch \
--build-arg SDK=${SDK} --build-arg ARCH=${ARCH} --tag runner:${dist} .
fi
done