github.com/ferranbt/nomad@v0.9.3-0.20190607002617-85c449b7667c/website/scripts/test.sh (about)

     1  #!/bin/bash
     2  set -e
     3  
     4  # passed in from outer makefile, default to 0.3.35
     5  MMVERSION=${1-0.3.35}
     6  
     7  echo "Running website in container..."
     8  WEBSITE_CID=$(docker run \
     9      --detach \
    10      --rm \
    11      --publish "4567:4567" \
    12      --publish "35729:35729" \
    13      --volume "$PWD:/website" \
    14      hashicorp/middleman-hashicorp:${MMVERSION})
    15  echo "Website is launching in container ${WEBSITE_CID}."
    16  
    17  echo "Checking website for dead links using recursive wget..."
    18  wget -nv --recursive --level=10 --delete-after http://localhost:4567 && exit_code=$? || exit_code=$?
    19  echo "wget exit code: ${exit_code}"
    20  
    21  echo "Killing docker website container ${WEBSITE_CID}..." 
    22  docker kill ${WEBSITE_CID} || true
    23  
    24  exit ${exit_code}