Wait for db to be ready on the setup

Instead of doing a sleep hack, let's actually check that the database is there.
This commit is contained in:
meskio 2022-12-19 17:18:00 +01:00
parent 365821fda0
commit 2734427bd9
No known key found for this signature in database
GPG Key ID: 52B8F5AC97A2DA86
2 changed files with 5 additions and 3 deletions

View File

@ -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/*

6
setup
View File

@ -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"