Merge pull request #2862 from PavelSavushkinMix/feature/php_8.0_imagemagick

fix(IMAGEMAGICK extension): implement building extension for PHP 8.0 from source
This commit is contained in:
Shao Yu-Lung (Allen) 2021-03-12 10:02:19 +08:00 committed by GitHub
commit 08b395ed50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 97 additions and 12 deletions

View File

@ -93,7 +93,7 @@ services:
- NVM_NODEJS_ORG_MIRROR=${WORKSPACE_NVM_NODEJS_ORG_MIRROR} - NVM_NODEJS_ORG_MIRROR=${WORKSPACE_NVM_NODEJS_ORG_MIRROR}
- INSTALL_NODE=${WORKSPACE_INSTALL_NODE} - INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
- NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY} - NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY}
- NPM_FETCH_RETRIES=${WORKSPACE_NPM_FETCH_RETRIES} - NPM_FETCH_RETRIES=${WORKSPACE_NPM_FETCH_RETRIES}
- NPM_FETCH_RETRY_FACTOR=${WORKSPACE_NPM_FETCH_RETRY_FACTOR} - NPM_FETCH_RETRY_FACTOR=${WORKSPACE_NPM_FETCH_RETRY_FACTOR}
- NPM_FETCH_RETRY_MINTIMEOUT=${WORKSPACE_NPM_FETCH_RETRY_MINTIMEOUT} - NPM_FETCH_RETRY_MINTIMEOUT=${WORKSPACE_NPM_FETCH_RETRY_MINTIMEOUT}
- NPM_FETCH_RETRY_MAXTIMEOUT=${WORKSPACE_NPM_FETCH_RETRY_MAXTIMEOUT} - NPM_FETCH_RETRY_MAXTIMEOUT=${WORKSPACE_NPM_FETCH_RETRY_MAXTIMEOUT}
@ -152,6 +152,7 @@ services:
- YARN_VERSION=${WORKSPACE_YARN_VERSION} - YARN_VERSION=${WORKSPACE_YARN_VERSION}
- DRUSH_VERSION=${WORKSPACE_DRUSH_VERSION} - DRUSH_VERSION=${WORKSPACE_DRUSH_VERSION}
- AST_VERSION=${WORKSPACE_AST_VERSION} - AST_VERSION=${WORKSPACE_AST_VERSION}
- IMAGEMAGICK_VERSION=${WORKSPACE_IMAGEMAGICK_VERSION}
- TZ=${WORKSPACE_TIMEZONE} - TZ=${WORKSPACE_TIMEZONE}
- BLACKFIRE_CLIENT_ID=${BLACKFIRE_CLIENT_ID} - BLACKFIRE_CLIENT_ID=${BLACKFIRE_CLIENT_ID}
- BLACKFIRE_CLIENT_TOKEN=${BLACKFIRE_CLIENT_TOKEN} - BLACKFIRE_CLIENT_TOKEN=${BLACKFIRE_CLIENT_TOKEN}
@ -261,6 +262,7 @@ services:
- DOWNGRADE_OPENSSL_TLS_AND_SECLEVEL=${PHP_DOWNGRADE_OPENSSL_TLS_AND_SECLEVEL} - DOWNGRADE_OPENSSL_TLS_AND_SECLEVEL=${PHP_DOWNGRADE_OPENSSL_TLS_AND_SECLEVEL}
- PUID=${PHP_FPM_PUID} - PUID=${PHP_FPM_PUID}
- PGID=${PHP_FPM_PGID} - PGID=${PHP_FPM_PGID}
- IMAGEMAGICK_VERSION=${PHP_FPM_IMAGEMAGICK_VERSION}
- LOCALE=${PHP_FPM_DEFAULT_LOCALE} - LOCALE=${PHP_FPM_DEFAULT_LOCALE}
- PHP_FPM_NEW_RELIC=${PHP_FPM_NEW_RELIC} - PHP_FPM_NEW_RELIC=${PHP_FPM_NEW_RELIC}
- PHP_FPM_NEW_RELIC_KEY=${PHP_FPM_NEW_RELIC_KEY} - PHP_FPM_NEW_RELIC_KEY=${PHP_FPM_NEW_RELIC_KEY}
@ -325,6 +327,7 @@ services:
- INSTALL_XMLRPC=${PHP_WORKER_INSTALL_XMLRPC} - INSTALL_XMLRPC=${PHP_WORKER_INSTALL_XMLRPC}
- PUID=${PHP_WORKER_PUID} - PUID=${PHP_WORKER_PUID}
- PGID=${PHP_WORKER_PGID} - PGID=${PHP_WORKER_PGID}
- IMAGEMAGICK_VERSION=${PHP_WORKER_IMAGEMAGICK_VERSION}
volumes: volumes:
- ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG} - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG}
- ./php-worker/supervisord.d:/etc/supervisord.d - ./php-worker/supervisord.d:/etc/supervisord.d
@ -358,6 +361,7 @@ services:
- INSTALL_AUDIOWAVEFORM=${LARAVEL_HORIZON_INSTALL_AUDIOWAVEFORM} - INSTALL_AUDIOWAVEFORM=${LARAVEL_HORIZON_INSTALL_AUDIOWAVEFORM}
- PUID=${LARAVEL_HORIZON_PUID} - PUID=${LARAVEL_HORIZON_PUID}
- PGID=${LARAVEL_HORIZON_PGID} - PGID=${LARAVEL_HORIZON_PGID}
- IMAGEMAGICK_VERSION=${LARAVEL_HORIZON_IMAGEMAGICK_VERSION}
volumes: volumes:
- ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER} - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}
- ./laravel-horizon/supervisord.d:/etc/supervisord.d - ./laravel-horizon/supervisord.d:/etc/supervisord.d
@ -1892,7 +1896,7 @@ services:
- "3000:3000" - "3000:3000"
container_name: react container_name: react
stdin_open: true stdin_open: true
environment: environment:
- CHOKIDAR_USEPOLLING=true - CHOKIDAR_USEPOLLING=true
networks: networks:
- frontend - frontend

View File

@ -157,6 +157,7 @@ WORKSPACE_INSTALL_POWERLINE=false
WORKSPACE_INSTALL_SUPERVISOR=false WORKSPACE_INSTALL_SUPERVISOR=false
WORKSPACE_INSTALL_IMAGE_OPTIMIZERS=false WORKSPACE_INSTALL_IMAGE_OPTIMIZERS=false
WORKSPACE_INSTALL_IMAGEMAGICK=false WORKSPACE_INSTALL_IMAGEMAGICK=false
WORKSPACE_IMAGEMAGICK_VERSION=latest
WORKSPACE_INSTALL_TERRAFORM=false WORKSPACE_INSTALL_TERRAFORM=false
WORKSPACE_INSTALL_DUSK_DEPS=false WORKSPACE_INSTALL_DUSK_DEPS=false
WORKSPACE_INSTALL_PG_CLIENT=false WORKSPACE_INSTALL_PG_CLIENT=false
@ -204,6 +205,7 @@ PHP_FPM_INSTALL_BCMATH=true
PHP_FPM_INSTALL_MYSQLI=true PHP_FPM_INSTALL_MYSQLI=true
PHP_FPM_INSTALL_INTL=true PHP_FPM_INSTALL_INTL=true
PHP_FPM_INSTALL_IMAGEMAGICK=true PHP_FPM_INSTALL_IMAGEMAGICK=true
PHP_FPM_IMAGEMAGICK_VERSION=latest
PHP_FPM_INSTALL_OPCACHE=true PHP_FPM_INSTALL_OPCACHE=true
PHP_FPM_INSTALL_IMAGE_OPTIMIZERS=true PHP_FPM_INSTALL_IMAGE_OPTIMIZERS=true
PHP_FPM_INSTALL_PHPREDIS=true PHP_FPM_INSTALL_PHPREDIS=true
@ -272,6 +274,7 @@ PHP_FPM_NEW_RELIC_APP_NAME=app_name
PHP_WORKER_INSTALL_BZ2=false PHP_WORKER_INSTALL_BZ2=false
PHP_WORKER_INSTALL_GD=false PHP_WORKER_INSTALL_GD=false
PHP_WORKER_INSTALL_IMAGEMAGICK=false PHP_WORKER_INSTALL_IMAGEMAGICK=false
PHP_WORKER_IMAGEMAGICK_VERSION=latest
PHP_WORKER_INSTALL_GMP=false PHP_WORKER_INSTALL_GMP=false
PHP_WORKER_INSTALL_PGSQL=false PHP_WORKER_INSTALL_PGSQL=false
PHP_WORKER_INSTALL_BCMATH=false PHP_WORKER_INSTALL_BCMATH=false
@ -312,6 +315,7 @@ LARAVEL_HORIZON_INSTALL_BZ2=false
LARAVEL_HORIZON_INSTALL_GD=false LARAVEL_HORIZON_INSTALL_GD=false
LARAVEL_HORIZON_INSTALL_GMP=false LARAVEL_HORIZON_INSTALL_GMP=false
LARAVEL_HORIZON_INSTALL_IMAGEMAGICK=false LARAVEL_HORIZON_INSTALL_IMAGEMAGICK=false
LARAVEL_HORIZON_IMAGEMAGICK_VERSION=latest
LARAVEL_HORIZON_INSTALL_SOCKETS=false LARAVEL_HORIZON_INSTALL_SOCKETS=false
LARAVEL_HORIZON_INSTALL_YAML=false LARAVEL_HORIZON_INSTALL_YAML=false
LARAVEL_HORIZON_INSTALL_ZIP_ARCHIVE=false LARAVEL_HORIZON_INSTALL_ZIP_ARCHIVE=false

View File

@ -74,10 +74,28 @@ RUN if [ ${INSTALL_GMP} = true ]; then \
#Install ImageMagick package: #Install ImageMagick package:
ARG INSTALL_IMAGEMAGICK=false ARG INSTALL_IMAGEMAGICK=false
ARG IMAGEMAGICK_VERSION=latest
ENV IMAGEMAGICK_VERSION ${IMAGEMAGICK_VERSION}
RUN set -eux; \ RUN set -eux; \
if [ ${INSTALL_IMAGEMAGICK} = true ]; then \ if [ ${INSTALL_IMAGEMAGICK} = true ]; then \
apk add --update --no-cache imagemagick-dev; \ apk add --update --no-cache imagemagick-dev; \
pecl install imagick; \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \
apk add --update --no-cache git && \
cd /tmp && \
if [ ${IMAGEMAGICK_VERSION} = "latest" ]; then \
git clone https://github.com/Imagick/imagick; \
else \
git clone --branch ${IMAGEMAGICK_VERSION} https://github.com/Imagick/imagick; \
fi && \
cd imagick && \
phpize && \
./configure && \
make && \
make install && \
rm -r /tmp/imagick; \
else \
pecl install imagick; \
fi && \
docker-php-ext-enable imagick; \ docker-php-ext-enable imagick; \
php -m | grep -q 'imagick'; \ php -m | grep -q 'imagick'; \
fi fi

View File

@ -343,7 +343,7 @@ RUN if [ ${INSTALL_XHPROF} = true ]; then \
# Install the php xhprof extension # Install the php xhprof extension
if [ $(php -r "echo PHP_MAJOR_VERSION;") = 7 ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = 7 ]; then \
curl -L -o /tmp/xhprof.tar.gz "https://github.com/tideways/php-xhprof-extension/archive/v5.0.1.tar.gz"; \ curl -L -o /tmp/xhprof.tar.gz "https://github.com/tideways/php-xhprof-extension/archive/v5.0.1.tar.gz"; \
else \ else \
curl -L -o /tmp/xhprof.tar.gz "https://codeload.github.com/phacility/xhprof/tar.gz/master"; \ curl -L -o /tmp/xhprof.tar.gz "https://codeload.github.com/phacility/xhprof/tar.gz/master"; \
fi \ fi \
&& mkdir -p xhprof \ && mkdir -p xhprof \
@ -684,10 +684,28 @@ RUN if [ ${INSTALL_IMAGE_OPTIMIZERS} = true ]; then \
USER root USER root
ARG INSTALL_IMAGEMAGICK=false ARG INSTALL_IMAGEMAGICK=false
ARG IMAGEMAGICK_VERSION=latest
ENV IMAGEMAGICK_VERSION ${IMAGEMAGICK_VERSION}
RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \ RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \
apt-get install -y libmagickwand-dev imagemagick && \ apt-get install -y libmagickwand-dev imagemagick && \
pecl install imagick && \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \
apt-get install -y git && \
cd /tmp && \
if [ ${IMAGEMAGICK_VERSION} = "latest" ]; then \
git clone https://github.com/Imagick/imagick; \
else \
git clone --branch ${IMAGEMAGICK_VERSION} https://github.com/Imagick/imagick; \
fi && \
cd imagick && \
phpize && \
./configure && \
make && \
make install && \
rm -r /tmp/imagick; \
else \
pecl install imagick; \
fi && \
docker-php-ext-enable imagick \ docker-php-ext-enable imagick \
;fi ;fi
@ -928,7 +946,7 @@ RUN if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \
libx11-dev \ libx11-dev \
libjpeg62 \ libjpeg62 \
libxtst6 \ libxtst6 \
fontconfig \ fontconfig \
libjpeg62-turbo \ libjpeg62-turbo \
xfonts-base \ xfonts-base \
xfonts-75dpi \ xfonts-75dpi \

View File

@ -69,11 +69,31 @@ RUN if [ ${INSTALL_GD} = true ]; then \
#Install ImageMagick: #Install ImageMagick:
ARG INSTALL_IMAGEMAGICK=false ARG INSTALL_IMAGEMAGICK=false
RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \ ARG IMAGEMAGICK_VERSION=latest
apk add --update imagemagick-dev imagemagick; \ ENV IMAGEMAGICK_VERSION ${IMAGEMAGICK_VERSION}
pecl install imagick; \ RUN set -eux; \
docker-php-ext-enable imagick \ if [ ${INSTALL_IMAGEMAGICK} = true ]; then \
;fi apk add --update --no-cache imagemagick-dev; \
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \
apk add --update --no-cache git && \
cd /tmp && \
if [ ${IMAGEMAGICK_VERSION} = "latest" ]; then \
git clone https://github.com/Imagick/imagick; \
else \
git clone --branch ${IMAGEMAGICK_VERSION} https://github.com/Imagick/imagick; \
fi && \
cd imagick && \
phpize && \
./configure && \
make && \
make install && \
rm -r /tmp/imagick; \
else \
pecl install imagick; \
fi && \
docker-php-ext-enable imagick; \
php -m | grep -q 'imagick'; \
fi
#Install GMP package: #Install GMP package:
ARG INSTALL_GMP=false ARG INSTALL_GMP=false

View File

@ -1200,9 +1200,30 @@ USER laradock
USER root USER root
ARG INSTALL_IMAGEMAGICK=false ARG INSTALL_IMAGEMAGICK=false
ARG IMAGEMAGICK_VERSION=latest
ENV IMAGEMAGICK_VERSION ${IMAGEMAGICK_VERSION}
RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \ RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \
apt-get install -y imagemagick php-imagick \ apt-get install -y libmagickwand-dev imagemagick && \
if [ $(php -r "echo PHP_MAJOR_VERSION;") = "8" ]; then \
apt-get install -y git && \
cd /tmp && \
if [ ${IMAGEMAGICK_VERSION} = "latest" ]; then \
git clone https://github.com/Imagick/imagick; \
else \
git clone --branch ${IMAGEMAGICK_VERSION} https://github.com/Imagick/imagick; \
fi && \
cd imagick && \
phpize && \
./configure && \
make && \
make install && \
rm -r /tmp/imagick; \
else \
pecl install imagick; \
fi && \
echo "extension=imagick.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/imagick.ini && \
ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/imagick.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-imagick.ini \
;fi ;fi
########################################################################### ###########################################################################