@@ -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
@@ -49,11 +55,14 @@ for version in "${versions[@]}"; do
49
55
tag=$( get_tag " $version " )
50
56
full_version=$( get_full_version " $version " )
51
57
52
- build " $version " " " " $tag "
53
-
54
58
# Get supported variants according to the target architecture.
55
59
# See details in function.sh
56
- IFS=' ' read -ra variants <<< " $(IFS=','; get_variants " $( dirname " $version " ) " " $2 " )"
60
+ IFS=' ' read -ra variants <<< " $(get_variants " $( dirname " $version " ) " " ${variant_arg[@]} " )"
61
+
62
+ # Only build the default Dockerfile if "default" is in the variant list
63
+ if [[ " ${variants[*]} " =~ " default" ]]; then
64
+ build " $version " " " " $tag "
65
+ fi
57
66
58
67
for variant in " ${variants[@]} " ; do
59
68
# Skip non-docker directories
0 commit comments