@@ -6,6 +6,12 @@ set -uo pipefail
66
77. functions.sh
88
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+
915function build () {
1016 local version
1117 local tag
@@ -37,7 +43,7 @@ function build () {
3743
3844cd " $( cd " ${0%/* } " && pwd -P) " || exit ;
3945
40- IFS=' ' read -ra versions <<< " $(IFS=','; get_versions . " $1 " )"
46+ IFS=' ' read -ra versions <<< " $(get_versions . " ${versions_arg[@]} " )"
4147if [ ${# versions[@]} -eq 0 ]; then
4248 fatal " No valid versions found!"
4349fi
@@ -51,8 +57,9 @@ for version in "${versions[@]}"; do
5157
5258 # Get supported variants according to the target architecture.
5359 # 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[@]} " )"
5561
62+ # Only build the default Dockerfile if "default" is in the variant list
5663 if [[ " ${variants[*]} " =~ " default" ]]; then
5764 build " $version " " " " $tag "
5865 fi
0 commit comments