60 lines
1.4 KiB
Bash
Executable File
60 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e;
|
|
|
|
export WORDPRESS_ROOT=/app/wordpress
|
|
|
|
install() {
|
|
echo "Install Wordpress $WORDPRESS_ROOT"
|
|
mkdir -p $WORDPRESS_ROOT
|
|
cd $WORDPRESS_ROOT
|
|
wp core download
|
|
config
|
|
}
|
|
|
|
install_themes() {
|
|
echo "Install Themes"
|
|
rsync -avz /tmp/wordpress/themes/ /app/wordpress/wp-content/themes/
|
|
}
|
|
|
|
install_plugins() {
|
|
echo "Install Plugins"
|
|
rsync -avz /tmp/wordpress/plugins/ /app/wordpress/wp-content/plugins/
|
|
}
|
|
|
|
config() {
|
|
echo "Config Wordpress $WORDPRESS_ROOT"
|
|
cd $WORDPRESS_ROOT
|
|
echo "Create Config"
|
|
wp config create --dbname=$MYSQL_DATABASE --dbuser=$MYSQL_USER --dbpass=$MYSQL_PASSWORD --dbhost=$MYSQL_HOST --locale=es_ES
|
|
echo "Install Worpdress"
|
|
if ! wp core is-installed; then
|
|
wp core install --url="$WP_URL" --title="$WP_TITLE" --admin_user="$WP_USER" --admin_password="$WP_PASS" --admin_email="$WP_EMAIL" --path="/app/wordpress/"
|
|
fi
|
|
}
|
|
|
|
update() {
|
|
echo "Update Wordpress"
|
|
cd $WORDPRESS_ROOT
|
|
#https://make.wordpress.org/cli/handbook/
|
|
wp core update --path="/app/wordpress/"
|
|
#wp plugin update --all --path="/app/wordpress/"
|
|
#wp theme update --all --path="/app/wordpress/"
|
|
}
|
|
|
|
#mkdir -p /app/log/
|
|
|
|
[ -d /app/wordpress ] || install
|
|
[ -f /app/wordpress/wp-config.php ] || config
|
|
|
|
# WP-CLI install
|
|
# https://www.cloudways.com/blog/install-wordpress-using-wp-cli/
|
|
|
|
#update
|
|
#install_themes
|
|
#install_plugins
|
|
|
|
echo "Starting Wordpress"
|
|
|
|
exec $@
|