From 71375fbe5032e21ddff6366cdb7790fa28e7dae5 Mon Sep 17 00:00:00 2001 From: Gillis Van Ginderachter Date: Wed, 21 Jun 2017 02:14:59 +0100 Subject: [PATCH] Allow Postgres database connection when using the docker image (#342) * Add pgsql driver and use correct port in waitfordb.sh. * Log host while waiting for database. --- Dockerfile | 2 +- docker/waitfordb.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2d8666c4d..fd22c2f3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.6 EXPOSE 80:80 -RUN apk update && apk add apache2 curl git make netcat-openbsd nodejs-current-npm openssl php7 php7-apache2 php7-ctype php7-dom php7-fileinfo php7-gd php7-iconv php7-intl php7-json php7-mbstring php7-mysqli php7-openssl php7-pdo_mysql php7-phar php7-session php7-tokenizer php7-xml php7-xmlreader php7-xmlwriter php7-zip php7-zlib +RUN apk update && apk add apache2 curl git make netcat-openbsd nodejs-current-npm openssl php7 php7-apache2 php7-ctype php7-dom php7-fileinfo php7-gd php7-iconv php7-intl php7-json php7-mbstring php7-mysqli php7-openssl php7-pdo_mysql php7-phar php7-session php7-tokenizer php7-xml php7-xmlreader php7-xmlwriter php7-zip php7-zlib php7-pgsql php7-pdo_pgsql RUN npm install -g bower RUN mkdir -p /run/apache2 diff --git a/docker/waitfordb.sh b/docker/waitfordb.sh index 108dda869..37966e9a5 100755 --- a/docker/waitfordb.sh +++ b/docker/waitfordb.sh @@ -1,12 +1,12 @@ #!/bin/sh -echo "Connecting to ${DB_HOST}" +echo "Connecting to ${DB_HOST}:${DB_PORT}" while true; do - nc -z ${DB_HOST} 3306 && break - echo "Unable to connect to MySQL; sleeping" + nc -z ${DB_HOST} ${DB_PORT} && break + echo "Unable to connect to ${DB_HOST}:${DB_PORT}; sleeping" sleep 1 done -echo "Waiting for MySQL to settle" +echo "Waiting for database to settle" sleep 3