This commit is contained in:
		| @@ -1,13 +1,56 @@ | ||||
| #!/bin/sh | ||||
| #!/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") | ||||
|  | ||||
| if [ $PHP_VERSION = '74' ]; then  | ||||
| 	docker-php-ext-configure gd --with-freetype --with-jpeg | ||||
| else  | ||||
| 	docker-php-ext-configure gd \ | ||||
|         --with-freetype-dir=/usr/lib/ \ | ||||
|         --with-png-dir=/usr/lib/ \ | ||||
|         --with-jpeg-dir=/usr/lib/ \ | ||||
|         --with-gd | ||||
| fi | ||||
|  | ||||
| # | ||||
| # 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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user