-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·137 lines (127 loc) · 2.61 KB
/
build.sh
File metadata and controls
executable file
·137 lines (127 loc) · 2.61 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/env bash
set -e
skip_push=$1
img_build=
img_run=
targe_dir=
target_op=
BUILD_IMAGE=
RUN_IMAGE=
IMG_NAME=
ARCH=
GOARCH=
VERSION=ChangeMe
PS3='Select image:'
options=("nsq" "volantmq" "smartthings" "opensky" "heketi-ui" "chrome" "bintray-proxy" "Quit")
select opt in "${options[@]}"
do
targe_dir=$opt
IMG_NAME=$opt
case $opt in
"nsq")
img_build=(golang:1.11.13-alpine3.9
arm32v7/golang:1.11.13-alpine3.9)
img_run=(alpine:3.9
arm32v7/alpine:3.9)
VERSION=1.1.0
break
;;
"volantmq")
img_build=(golang:1.11.13-alpine3.9
arm32v7/golang:1.11.13-alpine3.9)
img_run=(alpine:3.9
arm32v7/alpine:3.9)
VERSION=1.2.0
break
;;
"smartthings")
img_build=(nil nil)
img_run=(node:10.7.0-alpine
arm32v6/node:9.6.1-alpine)
VERSION=1.1.0
break
;;
"opensky")
img_build=(debian:jessie
arm32v7/debian:jessie)
img_run=(debian:jessie-slim
arm32v7/debian:jessie-slim)
VERSION=1.0.0
break
;;
"heketi-ui")
img_build=(nil nil)
img_run=(node:10.11.0-alpine
arm32v6/node:10.11.0-alpine)
VERSION=1.0.0
break
;;
"chrome")
img_build=(nil nil)
img_run=(debian:stretch
arm32v7/debian:stretch)
VERSION=1.0.0
break
;;
"bintray-proxy")
echo "WARNING: arm must be built on actual arm"
img_build=(golang:1.11.0-alpine3.8
arm32v6/golang:1.11.0-alpine3.8)
img_run=(alpine:3.8
arm32v6/alpine:3.8)
VERSION=1.0.3
break
;;
"Quit")
exit 0
;;
*)
echo "Invalid image"
exit 1
;;
esac
done
IMG_NAME=gohomeio/${IMG_NAME}
echo "Curent version is ${VERSION}, concider increasing"
PS3='Select operation:'
options=("amd64" "arm32v6" "manifest" "Quit")
select opt in "${options[@]}"
do
ARCH=$opt
case $opt in
"amd64")
BUILD_IMAGE=${img_build[0]}
RUN_IMAGE=${img_run[0]}
GOARCH=amd64
break
;;
"arm32v6")
BUILD_IMAGE=${img_build[1]}
RUN_IMAGE=${img_run[1]}
GOARCH=arm
break
;;
"manifest")
docker pull $IMG_NAME:arm32v6-${VERSION}
docker pull $IMG_NAME:amd64-${VERSION}
docker manifest create $IMG_NAME:${VERSION} $IMG_NAME:arm32v6-${VERSION} $IMG_NAME:amd64-${VERSION} --amend
docker manifest annotate $IMG_NAME:${VERSION} $IMG_NAME:arm32v6-${VERSION} --arch arm
docker manifest push $IMG_NAME:${VERSION}
exit 0
break
;;
"Quit")
exit 0
;;
*)
echo "Invalid arch"
exit 1
;;
esac
done
cd ${targe_dir}/docker
docker build --no-cache -t $IMG_NAME:$ARCH-${VERSION} --build-arg BUILD_IMAGE=${BUILD_IMAGE} \
--build-arg RUN_IMAGE=${RUN_IMAGE} --build-arg GOARCH=${GOARCH} .
if [ "${skip_push}" != "true" ]; then
docker push $IMG_NAME:$ARCH-${VERSION}
fi;