diff --git a/entrypoint.sh b/entrypoint.sh index 899aa61..7784a7f 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,13 +1,11 @@ #!/bin/bash set -eu - if [ -f wp-config.php ]; then rm wp-config.php fi : ${WP_LOCALE:=${WP_LOCALE:-en_US}} : ${WP_ADMIN_EMAIL:=${WP_ADMIN_EMAIL:-admin@example.com}} - : ${WP_DB_HOST:=db} : ${WP_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}} : ${WP_DB_PASSWORD:=''} @@ -17,6 +15,17 @@ wp core --allow-root download \ --version=${WP_VERSION} \ --force --debug +c=1 +until mysqladmin ping -h"$WP_DB_HOST" --silent &> /dev/null +do + c=$((c + 1)) + if [ $c -eq 60 ] + then + break + fi + sleep 2 +done + # Generate the wp-config file for debugging. wp core --allow-root config \ --dbhost="$WP_DB_HOST" \ @@ -46,12 +55,6 @@ EOF chown "www-data:www-data" .htaccess -until mysqladmin ping -h"$WP_DB_HOST" --silent &> /dev/null -do - ((c++)) && ((c==30)) && break - sleep 2 -done - # Create the database. wp db --allow-root create @@ -62,6 +65,4 @@ wp --allow-root core install \ --admin_password=password \ --admin_email="admin@test.com" \ --skip-email \ - exec "$@" - diff --git a/package.json b/package.json index 12f13c2..a49b2a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bigbite/wp-cypress", - "version": "0.1.3", + "version": "0.1.4", "description": "WordPress end to end testing with Cypress.io", "main": "lib/index.js", "repository": "https://github.com/bigbite/wp-cypress", @@ -11,7 +11,7 @@ }, "license": "MIT", "publishConfig": { - "access": "public" + "access": "private" }, "bin": { "wp-cypress": "./bin/script.sh"