2018-10-08 18:44:23 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2018-10-09 19:28:46 +00:00
|
|
|
# passed in from outer makefile, default to 0.3.35
|
2018-10-08 18:44:23 +00:00
|
|
|
MMVERSION=${1-0.3.35}
|
|
|
|
|
2018-10-09 19:28:46 +00:00
|
|
|
echo "Running website in container..."
|
2018-10-08 18:44:23 +00:00
|
|
|
WEBSITE_CID=$(docker run \
|
|
|
|
--detach \
|
|
|
|
--rm \
|
|
|
|
--publish "4567:4567" \
|
|
|
|
--publish "35729:35729" \
|
|
|
|
--volume "$PWD:/website" \
|
|
|
|
hashicorp/middleman-hashicorp:${MMVERSION})
|
2018-10-09 20:06:12 +00:00
|
|
|
echo "Website is launching in container ${WEBSITE_CID}."
|
2018-10-08 18:44:23 +00:00
|
|
|
|
2018-10-09 19:28:46 +00:00
|
|
|
echo "Checking website for dead links using recursive wget..."
|
2018-10-09 20:06:12 +00:00
|
|
|
wget -nv --recursive --level=10 --delete-after http://localhost:4567 && exit_code=$? || exit_code=$?
|
|
|
|
echo "wget exit code: ${exit_code}"
|
|
|
|
|
|
|
|
echo "Killing docker website container ${WEBSITE_CID}..."
|
|
|
|
docker kill ${WEBSITE_CID} || true
|
|
|
|
|
|
|
|
exit ${exit_code}
|