diff --git a/entrypoint.sh.tmpl b/entrypoint.sh.tmpl index cf804d6..c753120 100755 --- a/entrypoint.sh.tmpl +++ b/entrypoint.sh.tmpl @@ -2,6 +2,15 @@ set -eu -o pipefail +init_php() { + if ! type composer > /dev/null 2>&1; then + apt update && apt install -y curl git unzip + curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php + php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer --version=1.10.15 + composer -V + fi +} + init_db() { set -eu @@ -9,13 +18,6 @@ init_db() { apt update && apt install -y mariadb-client fi - if ! type composer > /dev/null 2>&1; then - apt update && apt install -y curl git unzip - curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php - php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer --version=1.10.15 - composer -V - fi - PASSWORD=$(cat /run/secrets/db_password) TABLE_COUNT=$(mysql -u "${DB_USER}" --password="$PASSWORD" -h "${DB_HOST}" "${DB_NAME}" -e "SELECT count(*) AS TOTAL FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'mediawiki';" -N -B) @@ -48,6 +50,7 @@ main() { install_extensions init_db + init_php } main