diff --git a/test/tests/docker-build.sh b/test/tests/docker-build.sh index 67391beafa..30d7ec88ac 100755 --- a/test/tests/docker-build.sh +++ b/test/tests/docker-build.sh @@ -3,11 +3,11 @@ set -e # wrapper around "docker build" that creates a temporary directory and copies files into it first so that arbitrary host directories can be copied into containers without bind mounts, but accepts a Dockerfile on stdin -# usage: ./docker-build.sh some-host-directory -t some-new-image:some-tag < "$tmp/Dockerfile" + +from="$(awk -F '[[:space:]]+' 'toupper($1) == "FROM" { print $2; exit }' "$tmp/Dockerfile")" +onbuilds="$(docker inspect -f '{{len .Config.OnBuild}}' "$from")" +if [ "$onbuilds" -gt 0 ]; then + # crap, the image we want to build has some ONBUILD instructions + # those are kind of going to ruin our day + # let's do some hacks to strip those bad boys out in a new fake layer + "$(dirname "$(readlink -f "$BASH_SOURCE")")/remove-onbuild.sh" "$from" "$imageTag" + awk -F '[[:space:]]+' 'toupper($1) == "FROM" { $2 = "'"$imageTag"'" } { print }' "$tmp/Dockerfile" > "$tmp/Dockerfile.new" + mv "$tmp/Dockerfile.new" "$tmp/Dockerfile" +fi + cp -a "$dir" "$tmp/dir" -docker build "$@" "$tmp" > /dev/null + +docker build -t "$imageTag" "$tmp" > /dev/null diff --git a/test/tests/jetty-hello-web/run.sh b/test/tests/jetty-hello-web/run.sh index fb52d030aa..4435988053 100755 --- a/test/tests/jetty-hello-web/run.sh +++ b/test/tests/jetty-hello-web/run.sh @@ -13,7 +13,7 @@ clientImage="$image" # Create an instance of the container-under-test serverImage="$("$dir/../image-name.sh" librarytest/jetty-hello-web "$image")" -"$dir/../docker-build.sh" "$dir" -t "$serverImage" < "$tmp/$newId/json" +echo -n '1.0' > "$tmp/$newId/VERSION" +dd if=/dev/zero of="$tmp/$newId/layer.tar" bs=1k count=1 &> /dev/null # empty tar file +cat > "$tmp/repositories" <