Updated to wait-for and fixed cond-init.d script

This commit is contained in:
David Young 2017-07-21 22:41:52 +12:00
parent 79c5cd91f3
commit bdf3aed5c3
2 changed files with 11 additions and 9 deletions

View File

@ -24,7 +24,8 @@ COPY root /
RUN curl -L -s https://github.com/just-containers/s6-overlay/releases/download/v1.19.1.1/s6-overlay-amd64.tar.gz | tar xvzf - -C / RUN curl -L -s https://github.com/just-containers/s6-overlay/releases/download/v1.19.1.1/s6-overlay-amd64.tar.gz | tar xvzf - -C /
# Add wait-for-it.sh # Add wait-for-it.sh
ADD https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh /srv ADD https://raw.githubusercontent.com/Eficode/wait-for/master/wait-for /srv
RUN chmod 755 /srv/wait-for
# Expose Nginx ports. # Expose Nginx ports.
EXPOSE 8080 EXPOSE 8080

View File

@ -8,15 +8,16 @@
ename='DB'; ename='DB';
eport=5432; eport=5432;
if [ $DB_TYPE = 'pgsql ]; if [ '$DB_TYPE' = 'mysql' ];
then then
eport = 5432;
dbhost = DB_PORT_5432_TCP_ADDR
else
eport=3306; eport=3306;
dbhost = DB_PORT_3306_TCP_ADDR dbhost=$DB_PORT_3306_TCP_ADDR
else
eport=5432;
dbhost=$DB_PORT_5432_TCP_ADDR
fi fi
############# #############
# Run wait-for-it.sh to confirm DB comes up before we proceed # Run wait-for-it.sh to confirm DB comes up before we proceed
/srv/wait-for-it.sh $dbhost:$eport echo "Waiting for $dbhost:$eport..."
/srv/wait-for $dbhost:$eport -- echo "Done"