From 1a400900bb5f09a1bf56f1831e38cd4205989af5 Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Tue, 29 Oct 2024 12:26:51 -0300 Subject: [PATCH] Fix Imagick for PHP 8.3 --- 8.3-prod/Dockerfile | 10 ++++++++-- 8.3/Dockerfile | 10 ++++++++-- template/Dockerfile.blade.php | 11 +++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/8.3-prod/Dockerfile b/8.3-prod/Dockerfile index b5ab2b4..67d0b41 100644 --- a/8.3-prod/Dockerfile +++ b/8.3-prod/Dockerfile @@ -57,8 +57,14 @@ RUN adduser -D -u 1337 kool \ mysqli \ ftp \ && pecl install redis \ - && pecl install imagick \ - && docker-php-ext-enable imagick \ + && mkdir /tmp/imagick && cd /tmp/imagick \ + && curl -L -o /tmp/imagick.tar.gz https://github.com/Imagick/imagick/archive/refs/tags/3.7.0.tar.gz \ + && tar --strip-components=1 -xf /tmp/imagick.tar.gz \ + && phpize \ + && ./configure --with-webp=yes \ + && make \ + && make install \ + && echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini \ && docker-php-ext-enable redis \ && cp "/usr/local/etc/php/php.ini-production" "/usr/local/etc/php/php.ini" \ # composer diff --git a/8.3/Dockerfile b/8.3/Dockerfile index 01811d3..2707461 100644 --- a/8.3/Dockerfile +++ b/8.3/Dockerfile @@ -59,8 +59,14 @@ RUN adduser -D -u 1337 kool \ && pecl install redis \ && pecl install xdebug \ && pecl install pcov && docker-php-ext-enable pcov \ - && pecl install imagick \ - && docker-php-ext-enable imagick \ + && mkdir /tmp/imagick && cd /tmp/imagick \ + && curl -L -o /tmp/imagick.tar.gz https://github.com/Imagick/imagick/archive/refs/tags/3.7.0.tar.gz \ + && tar --strip-components=1 -xf /tmp/imagick.tar.gz \ + && phpize \ + && ./configure --with-webp=yes \ + && make \ + && make install \ + && echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini \ && docker-php-ext-enable redis \ && cp "/usr/local/etc/php/php.ini-development" "/usr/local/etc/php/php.ini" \ # composer diff --git a/template/Dockerfile.blade.php b/template/Dockerfile.blade.php index 9e87f8c..18cf062 100644 --- a/template/Dockerfile.blade.php +++ b/template/Dockerfile.blade.php @@ -73,8 +73,19 @@ && pecl install {{ version_compare($version, '8', '>=') ? 'xdebug' : 'xdebug-3.1.6' }} \ && pecl install pcov && docker-php-ext-enable pcov \ @endif +@if (version_compare($version, '8.2', '<=')) && pecl install imagick \ && docker-php-ext-enable imagick \ +@else + && mkdir /tmp/imagick && cd /tmp/imagick \ + && curl -L -o /tmp/imagick.tar.gz https://github.com/Imagick/imagick/archive/refs/tags/3.7.0.tar.gz \ + && tar --strip-components=1 -xf /tmp/imagick.tar.gz \ + && phpize \ + && ./configure --with-webp=yes \ + && make \ + && make install \ + && echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini \ +@endif && docker-php-ext-enable redis \ && cp "/usr/local/etc/php/php.ini-{{ $prod ? 'production' : 'development' }}" "/usr/local/etc/php/php.ini" \ # composer