From d3713dc96c3bb1fd08be4239dab19a6ad78e867d Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Fri, 31 May 2024 11:33:24 +0200 Subject: [PATCH] Update imagick package to 3.7.0 Also apply hack patch for preprocessor build failures --- 4.4/php8.1/apache/Dockerfile | 17 ++++++++++++++--- 4.4/php8.1/fpm-alpine/Dockerfile | 17 ++++++++++++++--- 4.4/php8.1/fpm/Dockerfile | 17 ++++++++++++++--- 4.4/php8.2/apache/Dockerfile | 17 ++++++++++++++--- 4.4/php8.2/fpm-alpine/Dockerfile | 17 ++++++++++++++--- 4.4/php8.2/fpm/Dockerfile | 17 ++++++++++++++--- 5.1/php8.1/apache/Dockerfile | 17 ++++++++++++++--- 5.1/php8.1/fpm-alpine/Dockerfile | 17 ++++++++++++++--- 5.1/php8.1/fpm/Dockerfile | 17 ++++++++++++++--- 5.1/php8.2/apache/Dockerfile | 17 ++++++++++++++--- 5.1/php8.2/fpm-alpine/Dockerfile | 17 ++++++++++++++--- 5.1/php8.2/fpm/Dockerfile | 17 ++++++++++++++--- Dockerfile.template | 17 +++++++++++++++++ 13 files changed, 185 insertions(+), 36 deletions(-) diff --git a/4.4/php8.1/apache/Dockerfile b/4.4/php8.1/apache/Dockerfile index c8413dd..2011305 100644 --- a/4.4/php8.1/apache/Dockerfile +++ b/4.4/php8.1/apache/Dockerfile @@ -61,9 +61,20 @@ RUN set -ex; \ zip \ ; \ # https://pecl.php.net/package/imagick - pecl install imagick-3.7.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) +# see also https://github.com/Imagick/imagick/pull/641 +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ +# TODO when imagick has another release, we should ditch this whole block and just update instead \ # some misbehaving extensions end up outputting to stdout out="$(php -r 'exit(0);')"; \ diff --git a/4.4/php8.1/fpm-alpine/Dockerfile b/4.4/php8.1/fpm-alpine/Dockerfile index 3ddb495..963ccf8 100644 --- a/4.4/php8.1/fpm-alpine/Dockerfile +++ b/4.4/php8.1/fpm-alpine/Dockerfile @@ -63,9 +63,20 @@ RUN set -ex; \ ; \ # WARNING: imagick is likely not supported on Alpine: https://github.com/Imagick/imagick/issues/328 # https://pecl.php.net/package/imagick - pecl install imagick-3.7.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) +# see also https://github.com/Imagick/imagick/pull/641 +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ +# TODO when imagick has another release, we should ditch this whole block and just update instead \ # some misbehaving extensions end up outputting to stdout out="$(php -r 'exit(0);')"; \ diff --git a/4.4/php8.1/fpm/Dockerfile b/4.4/php8.1/fpm/Dockerfile index 47d01c1..1ca2524 100644 --- a/4.4/php8.1/fpm/Dockerfile +++ b/4.4/php8.1/fpm/Dockerfile @@ -61,9 +61,20 @@ RUN set -ex; \ zip \ ; \ # https://pecl.php.net/package/imagick - pecl install imagick-3.7.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) +# see also https://github.com/Imagick/imagick/pull/641 +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ +# TODO when imagick has another release, we should ditch this whole block and just update instead \ # some misbehaving extensions end up outputting to stdout out="$(php -r 'exit(0);')"; \ diff --git a/4.4/php8.2/apache/Dockerfile b/4.4/php8.2/apache/Dockerfile index 585438d..a4e310f 100644 --- a/4.4/php8.2/apache/Dockerfile +++ b/4.4/php8.2/apache/Dockerfile @@ -61,9 +61,20 @@ RUN set -ex; \ zip \ ; \ # https://pecl.php.net/package/imagick - pecl install imagick-3.7.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) +# see also https://github.com/Imagick/imagick/pull/641 +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ +# TODO when imagick has another release, we should ditch this whole block and just update instead \ # some misbehaving extensions end up outputting to stdout out="$(php -r 'exit(0);')"; \ diff --git a/4.4/php8.2/fpm-alpine/Dockerfile b/4.4/php8.2/fpm-alpine/Dockerfile index f3b3c37..7266b7c 100644 --- a/4.4/php8.2/fpm-alpine/Dockerfile +++ b/4.4/php8.2/fpm-alpine/Dockerfile @@ -63,9 +63,20 @@ RUN set -ex; \ ; \ # WARNING: imagick is likely not supported on Alpine: https://github.com/Imagick/imagick/issues/328 # https://pecl.php.net/package/imagick - pecl install imagick-3.7.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) +# see also https://github.com/Imagick/imagick/pull/641 +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ +# TODO when imagick has another release, we should ditch this whole block and just update instead \ # some misbehaving extensions end up outputting to stdout out="$(php -r 'exit(0);')"; \ diff --git a/4.4/php8.2/fpm/Dockerfile b/4.4/php8.2/fpm/Dockerfile index a0e796c..27df4a3 100644 --- a/4.4/php8.2/fpm/Dockerfile +++ b/4.4/php8.2/fpm/Dockerfile @@ -61,9 +61,20 @@ RUN set -ex; \ zip \ ; \ # https://pecl.php.net/package/imagick - pecl install imagick-3.7.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) +# see also https://github.com/Imagick/imagick/pull/641 +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ +# TODO when imagick has another release, we should ditch this whole block and just update instead \ # some misbehaving extensions end up outputting to stdout out="$(php -r 'exit(0);')"; \ diff --git a/5.1/php8.1/apache/Dockerfile b/5.1/php8.1/apache/Dockerfile index 8ab0ebc..f324bbf 100644 --- a/5.1/php8.1/apache/Dockerfile +++ b/5.1/php8.1/apache/Dockerfile @@ -63,9 +63,20 @@ RUN set -ex; \ zip \ ; \ # https://pecl.php.net/package/imagick - pecl install imagick-3.7.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) +# see also https://github.com/Imagick/imagick/pull/641 +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ +# TODO when imagick has another release, we should ditch this whole block and just update instead \ # some misbehaving extensions end up outputting to stdout out="$(php -r 'exit(0);')"; \ diff --git a/5.1/php8.1/fpm-alpine/Dockerfile b/5.1/php8.1/fpm-alpine/Dockerfile index 1e72a54..7ffa35f 100644 --- a/5.1/php8.1/fpm-alpine/Dockerfile +++ b/5.1/php8.1/fpm-alpine/Dockerfile @@ -65,9 +65,20 @@ RUN set -ex; \ ; \ # WARNING: imagick is likely not supported on Alpine: https://github.com/Imagick/imagick/issues/328 # https://pecl.php.net/package/imagick - pecl install imagick-3.7.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) +# see also https://github.com/Imagick/imagick/pull/641 +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ +# TODO when imagick has another release, we should ditch this whole block and just update instead \ # some misbehaving extensions end up outputting to stdout out="$(php -r 'exit(0);')"; \ diff --git a/5.1/php8.1/fpm/Dockerfile b/5.1/php8.1/fpm/Dockerfile index b865e4b..502466d 100644 --- a/5.1/php8.1/fpm/Dockerfile +++ b/5.1/php8.1/fpm/Dockerfile @@ -63,9 +63,20 @@ RUN set -ex; \ zip \ ; \ # https://pecl.php.net/package/imagick - pecl install imagick-3.7.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) +# see also https://github.com/Imagick/imagick/pull/641 +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ +# TODO when imagick has another release, we should ditch this whole block and just update instead \ # some misbehaving extensions end up outputting to stdout out="$(php -r 'exit(0);')"; \ diff --git a/5.1/php8.2/apache/Dockerfile b/5.1/php8.2/apache/Dockerfile index 9da457c..41bdd7e 100644 --- a/5.1/php8.2/apache/Dockerfile +++ b/5.1/php8.2/apache/Dockerfile @@ -63,9 +63,20 @@ RUN set -ex; \ zip \ ; \ # https://pecl.php.net/package/imagick - pecl install imagick-3.7.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) +# see also https://github.com/Imagick/imagick/pull/641 +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ +# TODO when imagick has another release, we should ditch this whole block and just update instead \ # some misbehaving extensions end up outputting to stdout out="$(php -r 'exit(0);')"; \ diff --git a/5.1/php8.2/fpm-alpine/Dockerfile b/5.1/php8.2/fpm-alpine/Dockerfile index ec50b87..e375e7c 100644 --- a/5.1/php8.2/fpm-alpine/Dockerfile +++ b/5.1/php8.2/fpm-alpine/Dockerfile @@ -65,9 +65,20 @@ RUN set -ex; \ ; \ # WARNING: imagick is likely not supported on Alpine: https://github.com/Imagick/imagick/issues/328 # https://pecl.php.net/package/imagick - pecl install imagick-3.7.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) +# see also https://github.com/Imagick/imagick/pull/641 +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ +# TODO when imagick has another release, we should ditch this whole block and just update instead \ # some misbehaving extensions end up outputting to stdout out="$(php -r 'exit(0);')"; \ diff --git a/5.1/php8.2/fpm/Dockerfile b/5.1/php8.2/fpm/Dockerfile index cfbe360..c36e59f 100644 --- a/5.1/php8.2/fpm/Dockerfile +++ b/5.1/php8.2/fpm/Dockerfile @@ -63,9 +63,20 @@ RUN set -ex; \ zip \ ; \ # https://pecl.php.net/package/imagick - pecl install imagick-3.7.0; \ - docker-php-ext-enable imagick; \ - rm -r /tmp/pear; \ +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) +# see also https://github.com/Imagick/imagick/pull/641 +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ +# TODO when imagick has another release, we should ditch this whole block and just update instead \ # some misbehaving extensions end up outputting to stdout out="$(php -r 'exit(0);')"; \ diff --git a/Dockerfile.template b/Dockerfile.template index 6b36537..1cf450d 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -106,9 +106,26 @@ RUN set -ex; \ # WARNING: imagick is likely not supported on Alpine: https://github.com/Imagick/imagick/issues/328 {{ ) else "" end -}} # https://pecl.php.net/package/imagick +{{ if true then ( -}} +# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones) +# see also https://github.com/Imagick/imagick/pull/641 +# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit +# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92 + curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ + echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ + tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ + test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ + sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ + grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \ + docker-php-ext-install /tmp/imagick-3.7.0; \ + rm -rf imagick.tgz /tmp/imagick-3.7.0; \ +# TODO when imagick has another release, we should ditch this whole block and just update instead +{{ ) else ( -}} pecl install imagick-3.7.0; \ docker-php-ext-enable imagick; \ rm -r /tmp/pear; \ +{{ ) end -}} \ # some misbehaving extensions end up outputting to stdout out="$(php -r 'exit(0);')"; \