2024-01-04 13:07:01 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -ex -o errexit -o nounset -o pipefail
|
|
|
|
|
2024-01-15 18:44:43 +00:00
|
|
|
declare -a pecl_extensions=()
|
|
|
|
readarray -d ' ' -t pecl_extensions < <(echo -n "${PHP_PECL_EXTENSIONS:-}")
|
|
|
|
readarray -d ' ' -t -O "${#pecl_extensions[@]}" pecl_extensions < <(echo -n "${PHP_PECL_EXTENSIONS_EXTRA:-}")
|
2024-01-15 17:30:14 +00:00
|
|
|
|
2024-01-15 18:44:43 +00:00
|
|
|
declare -a php_extensions=()
|
|
|
|
readarray -d ' ' -t php_extensions < <(echo -n "${PHP_EXTENSIONS:-}")
|
|
|
|
readarray -d ' ' -t -O "${#php_extensions[@]}" php_extensions < <(echo -n "${PHP_EXTENSIONS_EXTRA:-}")
|
|
|
|
readarray -d ' ' -t -O "${#php_extensions[@]}" php_extensions < <(echo -n "${PHP_EXTENSIONS_DATABASE:-}")
|
2024-01-15 17:16:00 +00:00
|
|
|
|
2024-01-04 13:07:01 +00:00
|
|
|
# Grab the PHP source code so we can compile against it
|
|
|
|
docker-php-source extract
|
|
|
|
|
|
|
|
# PHP GD extensions
|
|
|
|
docker-php-ext-configure gd \
|
|
|
|
--with-freetype \
|
|
|
|
--with-jpeg \
|
|
|
|
--with-webp \
|
|
|
|
--with-xpm
|
|
|
|
|
|
|
|
# Optional script folks can copy into their image to do any [docker-php-ext-configure] work before the [docker-php-ext-install]
|
|
|
|
# this can also overwirte the [gd] configure above by simply running it again
|
2024-01-15 18:44:43 +00:00
|
|
|
declare -r custom_pre_configure_script=""
|
|
|
|
if [[ -e "${custom_pre_configure_script}" ]]; then
|
|
|
|
if [ ! -x "${custom_pre_configure_script}" ]; then
|
|
|
|
echo >&2 "ERROR: found ${custom_pre_configure_script} but its not executable - please [chmod +x] the file!"
|
2024-01-04 13:07:01 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-01-15 18:44:43 +00:00
|
|
|
"${custom_pre_configure_script}"
|
2024-01-04 13:07:01 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Install pecl extensions
|
2024-01-15 18:44:43 +00:00
|
|
|
pecl install "${pecl_extensions[@]}"
|
2024-01-04 13:07:01 +00:00
|
|
|
|
|
|
|
# PHP extensions (dependencies)
|
2024-01-15 18:44:43 +00:00
|
|
|
docker-php-ext-install -j "$(nproc)" "${php_extensions[@]}"
|
2024-01-04 13:07:01 +00:00
|
|
|
|
|
|
|
# Enable all extensions
|
2024-01-15 18:44:43 +00:00
|
|
|
docker-php-ext-enable "${pecl_extensions[@]}" "${php_extensions[@]}"
|