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