diff --git a/Dockerfile b/Dockerfile index 6de0671..da871e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 / # 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 8080 diff --git a/root/etc/cont-init.d/98-wait-for-db b/root/etc/cont-init.d/98-wait-for-db index 47458f5..c7b5ece 100644 --- a/root/etc/cont-init.d/98-wait-for-db +++ b/root/etc/cont-init.d/98-wait-for-db @@ -5,18 +5,19 @@ ############# # This simply duplicates the logic from ttrss-configure-db.php -ename = 'DB'; -eport = 5432; +ename='DB'; +eport=5432; -if [ $DB_TYPE = 'pgsql ]; +if [ '$DB_TYPE' = 'mysql' ]; then - eport = 5432; - dbhost = DB_PORT_5432_TCP_ADDR + eport=3306; + dbhost=$DB_PORT_3306_TCP_ADDR else - eport = 3306; - dbhost = DB_PORT_3306_TCP_ADDR + eport=5432; + dbhost=$DB_PORT_5432_TCP_ADDR fi ############# # 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"