#!/usr/bin/env bash set -x # Wait until an HTTP request succeeds against localhost:PORT function ping_server(){ while true; do if curl -sSf "http://localhost:${PORT:-80}" >/dev/null; then exit 0 fi done } # Timeout after 2 min if we still haven't gotten a response timeout 120s ping_server