#! /bin/bash # set -o allexport; source .env; set +o allexport echo "Setting up docker volume and network..."; docker volume create $PREFIX-web; docker volume create $PREFIX-db; docker network create $PREFIX; docker network connect $PREFIX traefik; docker-compose up -d web; while ! docker ps -q -f name=$PREFIX-web; do echo "Waiting for the web container to be up and running..."; sleep 1; done docker-compose up -d db; while ! docker ps -q -f name=$PREFIX-db; do echo "Waiting for the db container to be up and running..."; sleep 1; done while ! docker exec wptest-web /bin/sh -c "mysqladmin ping -h $PREFIX-db -P 3306 --protocol=tcp -u user -puser --silent" ; do echo "Waiting for the mysql server in the db container to be up and running..."; sleep 1; done echo "Installing WordPress" docker exec --user www-data $PREFIX-web /bin/sh -c "wp core download --version=$WP_VERSION --locale=$WP_LOCALE --path=/var/www/html"; docker exec --user www-data $PREFIX-web /bin/sh -c 'wp config create --skip-check --dbname='"$PREFIX"' --dbuser='"$DB_USER"' --dbpass='"$DB_USER_PASSWORD"' --dbhost='"$PREFIX-db"' --path=/var/www/html --force --extra-php <