forked from urchinfs/urchin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-build.sh
executable file
·61 lines (50 loc) · 1.18 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
set -o nounset
set -o errexit
set -o pipefail
curDir=$(cd "$(dirname "$0")" && pwd)
cd "${curDir}/../" || return
D7Y_VERSION=${D7Y_VERSION:-"latest"}
D7Y_REGISTRY=${D7Y_REGISTRY:-d7yio}
IMAGES_DIR="build/images"
BASE_IMAGE=${BASE_IMAGE:-alpine:3.16}
CGO_ENABLED=${CGO_ENABLED:-0}
GOPROXY=${GOPROXY:-`go env GOPROXY`}
GOTAGS=${GOTAGS:-}
GOGCFLAGS=${GOGCFLAGS:-}
GOOS=${GOOS:-linux}
GOARCH=${GOARCH:-amd64}
# enable bash debug output
DEBUG=${DEBUG:-}
if [[ -n "$DEBUG" ]]; then
set -x
fi
docker-build() {
name=$1
docker build \
--platform ${GOOS}/${GOARCH} \
--build-arg CGO_ENABLED="${CGO_ENABLED}" \
--build-arg GOPROXY="${GOPROXY}" \
--build-arg GOTAGS="${GOTAGS}" \
--build-arg GOGCFLAGS="${GOGCFLAGS}" \
--build-arg BASE_IMAGE="${BASE_IMAGE}" \
-t "${D7Y_REGISTRY}/${name}:${D7Y_VERSION}" \
-f "${IMAGES_DIR}/${name}/Dockerfile" .
}
git-submodule() {
git submodule update --init --recursive
}
main() {
case "${1-}" in
dfdaemon)
docker-build dfdaemon
;;
scheduler)
docker-build scheduler
;;
manager)
git-submodule
docker-build manager
esac
}
main "$@"