-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.sh
executable file
·68 lines (54 loc) · 1.47 KB
/
make.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
63
64
65
66
67
#!/usr/bin/env bash
set -uexo pipefail
#$rundir = $(readlink -f "${0%/*}")
which greadlink >/dev/null 2>/dev/null && readlink=greadlink || readlink=readlink
rundir=$($readlink -f "${0%/*}")
cd "$rundir"
SCOPE='deployable'
NAME='ndjbdns'
SCOPE_NAME="${SCOPE}/${NAME}"
VERSION="1.06"
PKG_NAME="ndjbdns-${VERSION}"
PKG_FILE="${PKG_NAME}.tar.gz"
PKG_BUILD_FILE="${PKG_NAME}-build.tar.gz"
PKG_BUILD_FILE_TMP="${PKG_BUILD_FILE}.tmp"
get(){
#curl http://pjp.dgplug.org/ndjbdns/${PKG_FILE} > "$rundir"/${PKG_FILE}.tmp
wget -O "$rundir"/${PKG_FILE}.tmp http://pjp.dgplug.org/ndjbdns/${PKG_FILE}
mv $rundir"/${PKG_FILE}.tmp" "$rundir/${PKG_FILE}"
}
build_build(){
docker build -f Dockerfile.build -t "${SCOPE_NAME}-build" "$rundir"
# remove GZIP mod time header so checksums are consistant
docker run -e 'GZIP=-n' "${SCOPE_NAME}-build" tar -cvpzf - "/${NAME}" > "${PKG_BUILD_FILE_TMP}"
mv "${PKG_BUILD_FILE_TMP}" "${PKG_BUILD_FILE}"
}
build_app(){
docker build -f Dockerfile.app -t "${SCOPE_NAME}" "$rundir"
}
build_dnscache(){
cd "$rundir"/dnscache
docker build -t "${SCOPE_NAME}-dnscache" .
}
build_tinydns(){
cd "$rundir"/tinydns
docker build -t "${SCOPE_NAME}-tinydns" .
}
build(){
build_build
build_app
build_dnscache
build_tinydns
}
push(){
docker push "${SCOPE_NAME}"
docker push "${SCOPE_NAME}-tinydns"
docker push "${SCOPE_NAME}-dnscache"
}
help(){
set +x
echo "Available commands:"
compgen -A function | awk '{print " ",$0}'
}
ARG=${1:-build}
$ARG