Projet 42: Sujet: Conteneuriser un serveur wordpress à l'aide de docker, alpine/debian, nginx et mariadb
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
1.2 KiB

#!/bin/sh
while ! mariadb -h$MYSQL_HOST -u$WP_DATABASE_USR -p$WP_DATABASE_PWD $WP_DATABASE_NAME &>/dev/null; do
sleep 5
done
if [ ! -f "/var/www/wordpress/index.php" ]; then
wp core download --allow-root
wp config create --dbname=$WP_DATABASE_NAME --dbuser=$WP_DATABASE_USR --dbpass=$WP_DATABASE_PWD --dbhost=$MYSQL_HOST --dbcharset="utf8" --dbcollate="utf8_general_ci" --allow-root
wp core install --url=$WP_URL --title=$WP_TITLE --admin_user=$WP_ADMIN_USR --admin_password=$WP_ADMIN_PWD --admin_email=$WP_ADMIN_EMAIL --skip-email --allow-root
wp user create $WP_USR $WP_EMAIL --role=author --user_pass=$WP_PWD --allow-root
sed -i "90i define('WP_REDIS_HOST', 'redis');" wp-config.php
sed -i "91i define('WP_REDIS_PORT', 6379);" wp-config.php
sed -i "92i define('WP_REDIS_TIMEOUT', 1);" wp-config.php
sed -i "93i define('WP_REDIS_READ_TIMEOUT', 1);" wp-config.php
sed -i "94i define('WP_REDIS_DATABASE', 0);" wp-config.php
wp plugin install redis-cache --activate --allow-root
wp plugin update --all --allow-root
wget -O /var/www/wordpress/adminer.php https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1-mysql-en.php
fi
wp redis enable --allow-root
/usr/sbin/php-fpm8 -F -R