Skip to content

Instantly share code, notes, and snippets.

@lanwen
Created October 23, 2015 09:31
Show Gist options
  • Save lanwen/93a9956c80a3d56f7748 to your computer and use it in GitHub Desktop.
Save lanwen/93a9956c80a3d56f7748 to your computer and use it in GitHub Desktop.
Entrypoint example with waiter for port
#!/bin/bash
set -e
cp config/local.tpl config/local.yml
export DB_TCP="/dev/tcp/${DB_1_PORT_3306_TCP_ADDR}/${DB_1_PORT_3306_TCP_PORT}"
# See http://tldp.org/LDP/abs/html/devref1.html for description of this syntax.
while ! exec 6<>${DB_TCP}; do
echo "$(date) - still trying to connect to mysql at ${DB_TCP}"
sleep 1
done
bundle exec rake db:migrate
exec "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment