Skip to content

Commit 935fee5

Browse files
authored
Update Dockerfile
fix imagick 3.7.0 build
1 parent 4b0e750 commit 935fee5

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

Dockerfile

+16-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,22 @@ RUN set -eux; \
4949
\
5050
# Install PHP extensions
5151
docker-php-ext-install ${PHP_EXTS}; \
52-
pecl install imagick; \
52+
#pecl install imagick; \
53+
# WARNING: imagick is likely not supported on Alpine: https://github.com/Imagick/imagick/issues/328
54+
# https://pecl.php.net/package/imagick
55+
# https://github.com/Imagick/imagick/commit/5ae2ecf20a1157073bad0170106ad0cf74e01cb6 (causes a lot of build failures, but strangely only intermittent ones)
56+
# see also https://github.com/Imagick/imagick/pull/641
57+
# this is "pecl install imagick-3.7.0", but by hand so we can apply a small hack / part of the above commit
58+
# Thanks to @tianon https://github.com/docker-library/wordpress/commit/509adb58cbc7463a03e317931df65868ec8a3e92
59+
curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \
60+
echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \
61+
tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \
62+
grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \
63+
test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \
64+
sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \
65+
grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php && exit 1 || :; \
66+
docker-php-ext-install /tmp/imagick-3.7.0; \
67+
rm -rf imagick.tgz /tmp/imagick-3.7.0; \
5368
docker-php-ext-enable imagick; \
5469
\
5570
# Cleanup:

0 commit comments

Comments
 (0)