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.
|
|
|
#!/bin/sh
|
|
|
|
while ! mariadb -hmariadb -u$WP_DATABASE_USR -p$WP_DATABASE_PWD $WP_DATABASE_NAME &>/dev/null; do
|
|
|
|
echo "Wordpress waiting db..."
|
|
|
|
sleep 5
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ ! -f "index.php" ]; then
|
|
|
|
wp core download --allow-root
|
|
|
|
wp config create --dbname=$WP_DATABASE_NAME --dbuser=$WP_DATABASE_USR --dbpass=$WP_DATABASE_PWD --dbhost=mariadb --dbcharset="utf8" --dbcollate="utf8_general_ci" --allow-root
|
|
|
|
wp core install --url=https://$DOMAIN/wordpress --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
|
|
|
|
wp theme install generatepress --activate --allow-root
|
|
|
|
wp widget add meta sidebar-1 1
|
|
|
|
|
|
|
|
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 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 -R &> /dev/null
|