Skip to content

Instantly share code, notes, and snippets.

@asantos2000
Created June 25, 2018 12:51
Show Gist options
  • Save asantos2000/9043e7466d873bf4bd46a57651ccc1c3 to your computer and use it in GitHub Desktop.
Save asantos2000/9043e7466d873bf4bd46a57651ccc1c3 to your computer and use it in GitHub Desktop.
Run dredd image as a command line
#!/bin/bash
echo '***'
echo 'Root dir is /api'
export MYIP=`ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'`
echo 'Configure URL of tested API endpoint: http://api-srv::<enpoint-port>. Set api-srv to point to your server.'
echo 'This script will set api-srv to docker host machine - ' $MYIP
echo 'Optional. Save this script in your PATH and give it an alias:'
echo "alias dredd='bash ./scripts/dredd.sh'"
echo '***'
docker run -it --add-host "api-srv:$MYIP" -v $PWD:/api -w /api apiaryio/dredd dredd $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment