48 lines
1.4 KiB
Bash
Executable File
48 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ -n "$PHP_EXTENSIONS" ]; then
|
|
for extension in $PHP_EXTENSIONS; do
|
|
if ! php -m | grep -q $extension; then
|
|
docker-php-ext-install $PHP_EXTENSIONS
|
|
fi
|
|
done
|
|
fi
|
|
|
|
if ! id -u "user" >/dev/null 2>&1; then
|
|
useradd -u 1000 -m user
|
|
mkdir /var/www/html/vendor
|
|
chown -R user:user /var/www/html/vendor
|
|
fi
|
|
|
|
if [ ! -x /usr/bin/zip ]; then
|
|
apt update && apt install unzip
|
|
fi
|
|
|
|
if [ ! -x /usr/local/bin/wp ]; then
|
|
curl -z /usr/local/bin/wp -o /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
|
chmod +x /usr/local/bin/wp
|
|
fi
|
|
|
|
if [ -n "$USE_COMPOSER" ] && [ ! -x /usr/local/bin/composer ]; then
|
|
mkdir -p /var/www/.composer
|
|
chown user:user /var/www/.composer
|
|
|
|
curl https://getcomposer.org/installer -o /tmp/composer-setup.php
|
|
php -r "if (hash_file('sha384', '/tmp/composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
|
|
php /tmp/composer-setup.php
|
|
rm /tmp/composer-setup.php
|
|
|
|
mv /var/www/html/composer.phar /usr/local/bin/composer
|
|
fi
|
|
|
|
export APACHE_RUN_USER=user
|
|
export APACHE_RUN_GROUP=user
|
|
|
|
if [ -n "$@" ]; then
|
|
"$@"
|
|
fi
|
|
|
|
# Upstream ENTRYPOINT
|
|
# https://github.com/docker-library/wordpress/blob/master/php7.4/apache/Dockerfile#L120
|
|
/usr/local/bin/docker-entrypoint.sh apache2-foreground
|