-
Notifications
You must be signed in to change notification settings - Fork 119
/
build.sh
executable file
·40 lines (31 loc) · 1.04 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
build_cmd() {
docker build --build-arg "METEOR_VERSION=$1" --tag geoffreybooth/meteor-base:"$1" ./src
}
build() {
# Retry up to five times
build_cmd $1 || build_cmd $1 || build_cmd $1 || build_cmd $1 || build_cmd $1
}
source ./versions.sh
building_all_versions=true
if [ -n "${CI_VERSION:-}" ]; then
meteor_versions=( "${CI_VERSION:-}" )
building_all_versions=false
elif [[ "${1-x}" != x ]]; then
meteor_versions=( "$1" )
building_all_versions=false
fi
for version in "${meteor_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 [[ $building_all_versions ]]; then
docker tag geoffreybooth/meteor-base:"${version}" geoffreybooth/meteor-base:latest
printf "${GREEN}Success building Docker base images for all supported Meteor versions\n"
else
printf "${GREEN}Success building Docker base images for Meteor versions ${meteor_versions}\n"
fi