Fix wait for db/redis code
This commit is contained in:
Родитель
36ae8d89af
Коммит
14fef26e20
|
@ -17,7 +17,7 @@ RUN mkdir -p \
|
|||
/usr/share/man/man8 && \
|
||||
apt-get update && \
|
||||
apt-get install -y --no-install-recommends build-essential libpq-dev \
|
||||
mime-support postgresql-client gettext curl && \
|
||||
mime-support postgresql-client gettext curl netcat && \
|
||||
apt-get autoremove -y && \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
|
6
bin/run
6
bin/run
|
@ -16,11 +16,9 @@ usage() {
|
|||
wait_for() {
|
||||
tries=0
|
||||
echo "Waiting for $1 to listen on $2..."
|
||||
while true; do
|
||||
[[ $tries -lt $TRIES ]] || return
|
||||
(echo > /dev/tcp/$1/$2) >/dev/null 2>&1
|
||||
result=
|
||||
until nc -z $1 $2; do
|
||||
[[ $? -eq 0 ]] && return
|
||||
[[ $tries -lt $TRIES ]] || (echo "Timed out!" && exit 1)
|
||||
sleep $SLEEP
|
||||
tries=$((tries + 1))
|
||||
done
|
||||
|
|
Загрузка…
Ссылка в новой задаче