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

26 lines
870 B
Plaintext

#!/usr/bin/with-contenv bash
set -e
DISABLE_WP_UPDATES="${ENFORCE_DISABLE_WP_UPDATES:-true}"
# Designed to replace original, overcomplicated entrypoint script from official wordpress docker repository
# Why not use already available tools instead?!
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 "$@"
}
echo "> Verifying 'WordPress ${WP_VERSION}' installation..."
if wp core version;
then
echo "> Identified 'WordPress ${WP_VERSION}'"
else
echo "> Downloading 'WordPress ${WP_VERSION}'..."
wp core download --locale="${WP_LOCALE}" --version="${WP_VERSION}"
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
fi
fi