From 2734427bd901f91a9e7cc2fb2f6497e42924b2b0 Mon Sep 17 00:00:00 2001 From: meskio Date: Mon, 19 Dec 2022 17:18:00 +0100 Subject: [PATCH] Wait for db to be ready on the setup Instead of doing a sleep hack, let's actually check that the database is there. --- Dockerfile | 2 +- setup | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2bc85c6..cb3b55a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM registry.sindominio.net/nginx-php RUN apt-get update && \ apt-get -qy install --no-install-recommends \ - gnupg ca-certificates less curl jq unzip wget \ + gnupg ca-certificates less curl jq unzip wget default-mysql-client \ php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip php-redis && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* diff --git a/setup b/setup index 0222836..1001e4d 100755 --- a/setup +++ b/setup @@ -3,8 +3,10 @@ export WORDPRESS_ROOT=/app WP_CLI="/usr/local/bin/wp --allow-root --path=$WORDPRESS_ROOT" -# TODO: wait for the DB to be ready -sleep 10 +while ! $WP_CLI db check; do + echo "waiting for the db to be ready" + sleep 1 +done if ! $WP_CLI core is-installed; then echo "Install Wordpress"