Make screenshotter work with docker-machine (#494)

Since boot2docker has been superseded by docker-machine, we need this to
support developers on OS X.  The changes to the bash script ensure that we
clean up our containers even if taking screenshots gets hung and requires a
keyboard interrupt, as happens if the IP addresses were guessed incorrectly.
This commit is contained in:
Martin von Gagern
2016-10-08 05:15:54 +02:00
committed by Kevin Barabash
parent f1be1a3462
commit d50745d5a9
2 changed files with 30 additions and 11 deletions

View File

@@ -7,6 +7,15 @@
# suitable containers themselves, calling the screenshotter.js script
# directly.
cleanup() {
[[ "${container}" ]] \
&& docker stop "${container}" >/dev/null \
&& docker rm "${container}" >/dev/null
container=
}
container=
trap cleanup EXIT
status=0
for browserTag in firefox:2.48.2 chrome:2.48.2; do
browser=${browserTag%:*}
@@ -23,6 +32,6 @@ for browserTag in firefox:2.48.2 chrome:2.48.2; do
status=1
fi
echo "${res} taking screenshots, stopping and removing ${container:0:12}"
docker stop ${container} >/dev/null && docker rm ${container} >/dev/null
cleanup
done
exit ${status}