wordpress/rootfs/etc/cont-init.d/10-init-wordpress

26 lines
870 B
Plaintext
Raw Normal View History

2020-03-29 01:42:21 +01:00
#!/usr/bin/with-contenv bash
set -e
2020-06-17 01:37:45 +02:00
DISABLE_WP_UPDATES="${ENFORCE_DISABLE_WP_UPDATES:-true}"
2020-03-29 01:46:30 +01:00
# Designed to replace original, overcomplicated entrypoint script from official wordpress docker repository
# Why not use already available tools instead?!
2020-03-29 01:42:21 +01:00
function wp() {
# Running as root in container is OK as long as all security implications are observed and maintained
/usr/local/bin/wp --allow-root "$@"
}
2020-06-17 01:37:45 +02:00
echo "> Verifying 'WordPress ${WP_VERSION}' installation..."
2020-03-29 01:42:21 +01:00
if wp core version;
then
2020-06-17 01:37:45 +02:00
echo "> Identified 'WordPress ${WP_VERSION}'"
2020-03-29 01:42:21 +01:00
else
2020-06-17 01:37:45 +02:00
echo "> Downloading 'WordPress ${WP_VERSION}'..."
2020-03-29 01:42:21 +01:00
wp core download --locale="${WP_LOCALE}" --version="${WP_VERSION}"
2020-06-17 01:37:45 +02:00
if [ "${DISABLE_WP_UPDATES}" != "false" ]; then
echo "> Disabling WordPress updates..."
patch /var/www/html/wp-admin/update-core.php < /etc/wp-mods/wp-admin/update-core.php.patch
2020-06-17 01:37:45 +02:00
fi
2020-03-29 01:42:21 +01:00
fi