-
Notifications
You must be signed in to change notification settings - Fork 175
/
docker-build.sh
62 lines (53 loc) · 1.44 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
62
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
init_var() {
ECHO_TYPE="echo -e"
version=0.0.14
arch_arr="linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x"
}
echo_content() {
case $1 in
"red")
${ECHO_TYPE} "\033[31m$2\033[0m"
;;
"green")
${ECHO_TYPE} "\033[32m$2\033[0m"
;;
"yellow")
${ECHO_TYPE} "\033[33m$2\033[0m"
;;
"blue")
${ECHO_TYPE} "\033[34m$2\033[0m"
;;
"purple")
${ECHO_TYPE} "\033[35m$2\033[0m"
;;
"skyBlue")
${ECHO_TYPE} "\033[36m$2\033[0m"
;;
"white")
${ECHO_TYPE} "\033[37m$2\033[0m"
;;
esac
}
main() {
echo_content skyBlue "start build h-ui CPU:${arch_arr}"
if [[ ${version} != "latest" ]]; then
docker buildx build -t jonssonyan/h-ui:${version} --platform ${arch_arr} --push .
if [[ "$?" == "0" ]]; then
echo_content green "h-ui-linux Version:${version} CPU:${arch_arr} build success"
else
echo_content red "h-ui-linux Version:${version} CPU:${arch_arr} build failed"
fi
fi
docker buildx build -t jonssonyan/h-ui:latest --platform ${arch_arr} --push .
if [[ "$?" == "0" ]]; then
echo_content green "h-ui Version:latest CPU:${arch_arr} build success"
else
echo_content red "h-ui-linux Version:latest CPU:${arch_arr} build failed"
fi
echo_content skyBlue "h-ui CPU:${arch_arr} build finished"
}
init_var
main