@@ -6,6 +6,35 @@ set -uo pipefail
6
6
7
7
. functions.sh
8
8
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
+
9
38
cd " $( cd " ${0%/* } " && pwd -P) " || exit ;
10
39
11
40
IFS=' ' read -ra versions <<< " $(get_versions . " $@ " )"
@@ -20,14 +49,7 @@ for version in "${versions[@]}"; do
20
49
tag=$( get_tag " $version " )
21
50
full_version=$( get_full_version " $version " )
22
51
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 "
31
53
32
54
# Get supported variants according to the target architecture.
33
55
# See details in function.sh
@@ -37,14 +59,7 @@ for version in "${versions[@]}"; do
37
59
# Skip non-docker directories
38
60
[ -f " $version /$variant /Dockerfile" ] || continue
39
61
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 "
48
63
done
49
64
50
65
done
0 commit comments