-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathbuild.sh
executable file
·40 lines (33 loc) · 1.05 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
#!/usr/bin/env bash
source ./support.sh
source ./versions.sh
build_cmd() {
docker build --build-arg "METEOR_VERSION=$1" --tag geoffreybooth/meteor-base:"$1" ./src
if [[ $1 == $latest_version ]]; then
if ! docker tag geoffreybooth/meteor-base:"$1" geoffreybooth/meteor-base:latest; then
printf "${RED}Error tagging Docker base image for Meteor (latest version)${NC}\n"
exit 1
fi
fi
}
build() {
# Retry up to five times
build_cmd $1 || build_cmd $1 || build_cmd $1 || build_cmd $1 || build_cmd $1
}
for version in "${versions[@]}"; do
printf "${GREEN}Building Docker base image for Meteor ${version}...${NC}\n"
if ! build $version; then
printf "${RED}Error building Docker base image for Meteor ${version}${NC}\n"
exit 1
fi
done
if [[ "${#versions[@]}" -eq 1 ]]; then
printf "${GREEN}Success building Docker base image for Meteor ${versions}"
if [[ "${versions[0]}" == $latest_version ]]; then
printf " (latest version)\n"
else
printf "\n"
fi
else
printf "${GREEN}Success building Docker base images for all supported Meteor versions\n"
fi