@@ -6,6 +6,35 @@ set -uo pipefail
66
77. functions.sh
88
9+ function build () {
10+ local version
11+ local tag
12+ local variant
13+ local full_tag
14+ local path
15+ version=" $1 " ; shift
16+ variant=" $1 " ; shift
17+ tag=" $1 " ; shift
18+
19+ if [ -z " $variant " ]; then
20+ full_tag=" $tag "
21+ path=" $version /$variant "
22+ else
23+ full_tag=" $tag -$variant "
24+ path=" $version /$variant "
25+ fi
26+
27+ info " Building $full_tag ..."
28+
29+ if ! docker build -t node:" $full_tag " " $path " ; then
30+ fatal " Build of $full_tag failed!"
31+ fi
32+ info " Build of $full_tag succeeded."
33+
34+ info " Testing $full_tag "
35+ docker run --rm -v " $PWD /test-image.sh:/usr/local/bin/test.sh" node:" $full_tag " test.sh " $full_version "
36+ }
37+
938cd " $( cd " ${0%/* } " && pwd -P) " || exit ;
1039
1140IFS=' ' read -ra versions <<< " $(get_versions . " $@ " )"
@@ -20,14 +49,7 @@ for version in "${versions[@]}"; do
2049 tag=$( get_tag " $version " )
2150 full_version=$( get_full_version " $version " )
2251
23- info " Building $tag ..."
24-
25- if ! docker build -t node:" $tag " " $version " ; then
26- fatal " Build of $tag failed!"
27- fi
28- info " Build of $tag succeeded."
29-
30- docker run --rm -v " $PWD /test-image.sh:/usr/local/bin/test.sh" node:" $tag " test.sh " $full_version "
52+ build " $version " " " " $tag "
3153
3254 # Get supported variants according to the target architecture.
3355 # See details in function.sh
@@ -37,14 +59,7 @@ for version in "${versions[@]}"; do
3759 # Skip non-docker directories
3860 [ -f " $version /$variant /Dockerfile" ] || continue
3961
40- info " Building $tag -$variant variant..."
41-
42- if ! docker build -t node:" $tag -$variant " " $version /$variant " ; then
43- fatal " Build of $tag -$variant failed!"
44- fi
45- info " Build of $tag -$variant succeeded."
46-
47- docker run --rm -v " $PWD /test-image.sh:/usr/local/bin/test.sh" node:" $tag -$variant " test.sh " $full_version "
62+ build " $version " " $variant " " $tag "
4863 done
4964
5065done
0 commit comments