php/docker/usr/local/bin/php_configure.sh
Aleksander Cynarski 7cab29a384
All checks were successful
continuous-integration/drone/push Build is passing
all modules, alpine version hardcode
2021-07-02 21:42:59 +02:00

56 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
PHP_VERSION=`php -r 'echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;'`
PHP_MODULES=("calendar" "bcmath" "bz2" "curl" "fileinfo" "gd" "gettext" "iconv" "imap" "intl" "ldap" "mbstring" "opcache" "pcntl" "pdo" "pdo_mysql" "pdo_pgsql" "pdo_sqlite" "pgsql" "phar" "session" "simplexml" "soap" "xml")
#
# Helper functions
#
declare -i term_width=120
h1() {
declare border padding text
border='\e[1;34m'"$(printf '=%.0s' $(seq 1 "$term_width"))"'\e[0m'
padding="$(printf ' %.0s' $(seq 1 $(((term_width - $(wc -m <<<"$*")) / 2))))"
text="\\e[1m$*\\e[0m"
echo -e "$border"
echo -e "${padding}${text}${padding}"
echo -e "$border"
}
h2() {
printf '\e[1;33m==>\e[37;1m %s\e[0m\n' "$*"
}
h1 "Configure PHP modules"
case $PHP_VERSION in
'80' )
h2 "Configure GD"
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp
;;
'74' )
h2 "Configure GD"
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp
h2 "Install json module"
docker-php-ext-install -j$(nproc) json
;;
* )
h2 "Configure GD"
docker-php-ext-configure gd \
--with-freetype-dir=/usr/lib/ \
--with-png-dir=/usr/lib/ \
--with-jpeg-dir=/usr/lib/ \
--with-gd
h2 "Install json module"
docker-php-ext-install -j$(nproc) json
break
esac
h1 "Install PHP modules"
for module in "${PHP_MODULES[@]}"
do
h1 "Install module: ${module}"
docker-php-ext-install -j$(nproc) $module
done