pixelfed/docker/shared/root/docker/install/php-extensions.sh

61 lines
1.5 KiB
Bash
Raw Normal View History

2024-01-04 13:07:01 +00:00
#!/bin/bash
set -ex -o errexit -o nounset -o pipefail
2024-01-15 17:30:14 +00:00
# shellcheck disable=SC2223
: ${PHP_PECL_EXTENSIONS:=""}
# shellcheck disable=SC2223
: ${PHP_PECL_EXTENSIONS_EXTRA:=""}
# shellcheck disable=SC2223
: ${PHP_EXTENSIONS:=""}
# shellcheck disable=SC2223
: ${PHP_EXTENSIONS_EXTRA:=""}
# shellcheck disable=SC2223
: ${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
if [[ -f /install/php-extension-configure.sh ]]; then
2024-01-15 17:16:00 +00:00
if [ ! -x "/install/php-extension-configure.sh" ]; then
2024-01-04 13:07:01 +00:00
echo >&2 "ERROR: found /install/php-extension-configure.sh but its not executable - please [chmod +x] the file!"
exit 1
fi
/install/php-extension-configure.sh
fi
# Install pecl extensions
2024-01-15 17:16:00 +00:00
pecl install "${PHP_PECL_EXTENSIONS}" "${PHP_PECL_EXTENSIONS_EXTRA}"
2024-01-04 13:07:01 +00:00
# PHP extensions (dependencies)
2024-01-15 17:23:32 +00:00
#
# shellcheck disable=SC2086
2024-01-15 17:16:00 +00:00
docker-php-ext-install \
-j "$(nproc)" \
2024-01-15 17:23:32 +00:00
${PHP_EXTENSIONS} \
${PHP_EXTENSIONS_EXTRA} \
${PHP_EXTENSIONS_DATABASE}
2024-01-04 13:07:01 +00:00
# Enable all extensions
2024-01-15 17:23:32 +00:00
#
# shellcheck disable=SC2086
2024-01-15 17:16:00 +00:00
docker-php-ext-enable \
2024-01-15 17:23:32 +00:00
${PHP_PECL_EXTENSIONS} \
${PHP_PECL_EXTENSIONS_EXTRA} \
${PHP_EXTENSIONS} \
${PHP_EXTENSIONS_EXTRA} \
${PHP_EXTENSIONS_DATABASE}