@@ -6,6 +6,12 @@ set -uo pipefail
6
6
7
7
. functions.sh
8
8
9
+ # Convert comma delimited cli arguments to arrays
10
+ # E.g. ./test-build.sh 4,6 slim,onbuild
11
+ # "4,6" becomes "4 6" and "slim,onbuild" becomes "slim onbuild"
12
+ IFS=' ,' read -ra versions_arg <<< " ${1:-}"
13
+ IFS=' ,' read -ra variant_arg <<< " ${2:-}"
14
+
9
15
function build () {
10
16
local version
11
17
local tag
@@ -37,7 +43,7 @@ function build () {
37
43
38
44
cd " $( cd " ${0%/* } " && pwd -P) " || exit ;
39
45
40
- IFS=' ' read -ra versions <<< " $(IFS=','; get_versions . " $1 " )"
46
+ IFS=' ' read -ra versions <<< " $(get_versions . " ${versions_arg[@]} " )"
41
47
if [ ${# versions[@]} -eq 0 ]; then
42
48
fatal " No valid versions found!"
43
49
fi
@@ -51,8 +57,9 @@ for version in "${versions[@]}"; do
51
57
52
58
# Get supported variants according to the target architecture.
53
59
# See details in function.sh
54
- IFS=' ' read -ra variants <<< " $(IFS=','; get_variants " $( dirname " $version " ) " " $2 " )"
60
+ IFS=' ' read -ra variants <<< " $(get_variants " $( dirname " $version " ) " " ${variant_arg[@]} " )"
55
61
62
+ # Only build the default Dockerfile if "default" is in the variant list
56
63
if [[ " ${variants[*]} " =~ " default" ]]; then
57
64
build " $version " " " " $tag "
58
65
fi
0 commit comments