#!/bin/sh # This script is used to install WordPress and configure it with a MariaDB database. # It checks for the presence of a database and user, creates them if they don't exist, # and sets up the WordPress configuration file with the database connection details. echo "Installing WordPress..." sleep 10 # Check if the database exists wp core download --allow-root --path=/var/www/html wp config create --allow-root \ --dbname=$MYSQL_DATABASE \ --dbuser=$MYSQL_USER \ --dbpass=$MYSQL_PASSWORD \ --dbhost=$DB_HOST \ --path=/var/www/html wp core install --allow-root \ --url=$DOMAIN_NAME \ --title=$WP_TITLE \ --admin_user=$WP_ADMIN \ --admin_password=$WP_ADMIN_PASSWORD \ --admin_email=$WP_ADMIN_EMAIL \ --path=/var/www/html wp user create --allow-root \ $WP_USER \ $WP_USER_EMAIL \ --role=author \ --user_pass=$WP_USER_PASSWORD \ --path=/var/www/html wp theme install --allow-root \ $WP_THEME \ --activate \ --path=/var/www/html echo "WordPress installation completed." exec "$@"