--- /dev/null
+#!/bin/sh
+
+set -e
+
+host=$(env | grep _TCP_ADDR | cut -d = -f 2)
+port=$(env | grep _TCP_PORT | cut -d = -f 2)
+
+echo -n "waiting for TCP connection to $host:$port..."
+
+while ! nc -w 1 $host $port 2>/dev/null
+do
+ echo -n .
+ sleep 1
+done
+
+echo 'ok'
#!/bin/sh
-
-docker-compose -f docker-compose.yml -f env/prod.yml up `if [ "$1" = "-bg" ]; then echo "-d"; fi`
\ No newline at end of file
+options = ""
+if [ "$1" = "-bg" ]; then
+ options = $options "-d";
+fi
+docker-compose -f docker-compose.yml -f env/prod.yml up $options
\ No newline at end of file