forked from disney/meteor-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·49 lines (38 loc) · 1.15 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
48
49
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
set -o allexport
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
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