Skip to content

Commit 2089e6f

Browse files
author
Christopher Horrell
committed
Ensure test image builds are tagged. Fixes #18
1 parent 413687b commit 2089e6f

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

test-build.sh

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,43 @@ fatal() {
1818
exit 1
1919
}
2020

21-
for DOCKERFILE in $DOCKERFILES ; do
22-
TAG=$(echo $DOCKERFILE | sed 's/Dockerfile//g')
23-
info "=========="
24-
info "Building $TAG..."
25-
docker build -q $TAG
21+
cd $(cd ${0%/*} && pwd -P);
22+
23+
versions=( "$@" )
24+
if [ ${#versions[@]} -eq 0 ]; then
25+
versions=( */ )
26+
fi
27+
versions=( "${versions[@]%/}" )
28+
29+
for version in "${versions[@]}"; do
30+
31+
tag=$(cat $version/Dockerfile | grep "ENV NODE_VERSION" | cut -d' ' -f3)
32+
33+
info "Building $tag..."
34+
docker build -q -t node:$tag $version
35+
2636
if [[ $? -gt 0 ]]; then
27-
fatal "Build of $TAG failed!"
37+
fatal "Build of $tag failed!"
2838
else
29-
info "Build of $TAG succeeded"
39+
info "Build of $tag succeeded."
3040
fi
41+
42+
variants=( onbuild slim wheezy )
43+
44+
for variant in "${variants[@]}"; do
45+
info "Building $tag-$variant variant..."
46+
docker build -q -t node:$tag-$variant $version/$variant
47+
48+
if [[ $? -gt 0 ]]; then
49+
fatal "Build of $tag-$variant failed!"
50+
else
51+
info "Build of $tag-$variant succeeded."
52+
fi
53+
54+
done
55+
3156
done
3257

3358
info "All builds successful!"
34-
info "Dockerfiles:"
35-
info "$DOCKERFILES"
3659

3760
exit 0

0 commit comments

Comments
 (0)