-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·47 lines (40 loc) · 1.11 KB
/
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
#!/bin/bash
PG_REPACK=(
"12,1.4.5"
"13,1.4.6"
"14,1.4.7"
"15,1.4.8"
"16,1.5.0"
"17,1.5.1"
)
# Check command exist function
_command_exists() {
type "$1" &> /dev/null
}
if _command_exists docker; then
DOCKER_BIN=$(which docker)
else
echo "ERROR: Command 'docker' not found."
exit 1
fi
# trap ctrl-c and call ctrl_c()
trap ctrl_c INT
function ctrl_c() {
echo "** Trapped CTRL-C"
exit 1
}
#${DOCKER_BIN} login -u XXXXX -p YYYYY
for DATA in ${PG_REPACK[@]}; do
PG_VER=$(echo "${DATA}" | awk -F',' '{print $1}')
PGREPACK_VER=$(echo "${DATA}" | awk -F',' '{print $2}')
echo "Docker build image 'pg-repack:${PGREPACK_VER}', postgres v${PG_VER}..."
${DOCKER_BIN} build -t cherts/pg-repack:${PGREPACK_VER} --no-cache --progress=plain -f ${PG_VER}/Dockerfile ${PG_VER}
if [ $? -eq 0 ]; then
echo "Done build image."
#echo "Docker push image 'pg-repack:${PGREPACK_VER}'..."
#${DOCKER_BIN} push cherts/pg-repack:${PGREPACK_VER}
else
echo "ERROR: Failed build image 'pg-repack:${PGREPACK_VER}', postgres v${PG_VER}"
exit 1
fi
done