From f130178136c00a6e6951591510bcc059490e4c54 Mon Sep 17 00:00:00 2001
From: J0WI <J0WI@users.noreply.github.com>
Date: Fri, 18 Apr 2025 13:37:27 +0000
Subject: [PATCH] Imagick 3.8.0 (#2417)

* Revert "Build imagick for PHP 8.3 (#2394)"

This reverts commit af005991484e03918488bb6cdb75750598a121f5.

* PHP imagick 3.8.0

Signed-off-by: J0WI <J0WI@users.noreply.github.com>

---------

Signed-off-by: J0WI <J0WI@users.noreply.github.com>
---
 29/apache/Dockerfile       | 18 +-----------------
 29/fpm-alpine/Dockerfile   | 18 +-----------------
 29/fpm/Dockerfile          | 18 +-----------------
 30/apache/Dockerfile       | 18 +-----------------
 30/fpm-alpine/Dockerfile   | 18 +-----------------
 30/fpm/Dockerfile          | 18 +-----------------
 31/apache/Dockerfile       | 20 ++------------------
 31/fpm-alpine/Dockerfile   | 20 ++------------------
 31/fpm/Dockerfile          | 20 ++------------------
 Dockerfile-alpine.template | 18 +-----------------
 Dockerfile-debian.template | 18 +-----------------
 update.sh                  |  3 +--
 versions.json              |  6 +++---
 13 files changed, 18 insertions(+), 195 deletions(-)

diff --git a/29/apache/Dockerfile b/29/apache/Dockerfile
index 266fc236..962f1bca 100644
--- a/29/apache/Dockerfile
+++ b/29/apache/Dockerfile
@@ -1,9 +1,6 @@
 # DO NOT EDIT: created by update.sh from Dockerfile-debian.template
 FROM php:8.2-apache-bookworm
 
-# Define the commit hash for imagick as a variable
-ENV IMAGICK_COMMIT_HASH d7d3c24af1b4f599897408f1714600b69a56473b
-
 # entrypoint.sh and cron.sh dependencies
 RUN set -ex; \
     \
@@ -68,23 +65,10 @@ RUN set -ex; \
         zip \
     ; \
     \
-# The master version on the imagick repository is compatible with PHP 8.3. However, the PECL version is not updated yet.
-# As soon as it will get updated, we can switch back to the PECL version, instead of having this workaround.
-    curl -fsSL -o imagick.tar.gz "https://github.com/Imagick/imagick/archive/$IMAGICK_COMMIT_HASH.tar.gz"; \
-    tar -xzf imagick.tar.gz -C /tmp; \
-    rm imagick.tar.gz; \
-    cd "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    sed -i "s/@PACKAGE_VERSION@/git-$(echo ${IMAGICK_COMMIT_HASH} | cut -c 1-7)/" php_imagick.h; \
-    phpize; \
-    ./configure; \
-    make; \
-    make install; \
-    cd; \
-    rm -r "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    \
 # pecl will claim success even if one install fails, so we need to perform each install separately
     pecl install APCu-5.1.24; \
     pecl install igbinary-3.2.16; \
+    pecl install imagick-3.8.0; \
     pecl install memcached-3.3.0 \
         --configureoptions 'enable-memcached-igbinary="yes"'; \
     pecl install redis-6.2.0 \
diff --git a/29/fpm-alpine/Dockerfile b/29/fpm-alpine/Dockerfile
index 3c79d672..937ae5dc 100644
--- a/29/fpm-alpine/Dockerfile
+++ b/29/fpm-alpine/Dockerfile
@@ -1,9 +1,6 @@
 # DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
 FROM php:8.2-fpm-alpine3.21
 
-# Define the commit hash for imagick as a variable
-ENV IMAGICK_COMMIT_HASH d7d3c24af1b4f599897408f1714600b69a56473b
-
 # entrypoint.sh and cron.sh dependencies
 RUN set -ex; \
     \
@@ -65,23 +62,10 @@ RUN set -ex; \
         zip \
     ; \
     \
-# The master version on the imagick repository is compatible with PHP 8.3. However, the PECL version is not updated yet.
-# As soon as it will get updated, we can switch back to the PECL version, instead of having this workaround.
-    curl -fsSL -o imagick.tar.gz "https://github.com/Imagick/imagick/archive/$IMAGICK_COMMIT_HASH.tar.gz"; \
-    tar -xzf imagick.tar.gz -C /tmp; \
-    rm imagick.tar.gz; \
-    cd "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    sed -i "s/@PACKAGE_VERSION@/git-$(echo ${IMAGICK_COMMIT_HASH} | cut -c 1-7)/" php_imagick.h; \
-    phpize; \
-    ./configure; \
-    make; \
-    make install; \
-    cd; \
-    rm -r "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    \
 # pecl will claim success even if one install fails, so we need to perform each install separately
     pecl install APCu-5.1.24; \
     pecl install igbinary-3.2.16; \
+    pecl install imagick-3.8.0; \
     pecl install memcached-3.3.0 \
         --configureoptions 'enable-memcached-igbinary="yes"'; \
     pecl install redis-6.2.0 \
diff --git a/29/fpm/Dockerfile b/29/fpm/Dockerfile
index e89e6e73..2d5ff91a 100644
--- a/29/fpm/Dockerfile
+++ b/29/fpm/Dockerfile
@@ -1,9 +1,6 @@
 # DO NOT EDIT: created by update.sh from Dockerfile-debian.template
 FROM php:8.2-fpm-bookworm
 
-# Define the commit hash for imagick as a variable
-ENV IMAGICK_COMMIT_HASH d7d3c24af1b4f599897408f1714600b69a56473b
-
 # entrypoint.sh and cron.sh dependencies
 RUN set -ex; \
     \
@@ -68,23 +65,10 @@ RUN set -ex; \
         zip \
     ; \
     \
-# The master version on the imagick repository is compatible with PHP 8.3. However, the PECL version is not updated yet.
-# As soon as it will get updated, we can switch back to the PECL version, instead of having this workaround.
-    curl -fsSL -o imagick.tar.gz "https://github.com/Imagick/imagick/archive/$IMAGICK_COMMIT_HASH.tar.gz"; \
-    tar -xzf imagick.tar.gz -C /tmp; \
-    rm imagick.tar.gz; \
-    cd "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    sed -i "s/@PACKAGE_VERSION@/git-$(echo ${IMAGICK_COMMIT_HASH} | cut -c 1-7)/" php_imagick.h; \
-    phpize; \
-    ./configure; \
-    make; \
-    make install; \
-    cd; \
-    rm -r "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    \
 # pecl will claim success even if one install fails, so we need to perform each install separately
     pecl install APCu-5.1.24; \
     pecl install igbinary-3.2.16; \
+    pecl install imagick-3.8.0; \
     pecl install memcached-3.3.0 \
         --configureoptions 'enable-memcached-igbinary="yes"'; \
     pecl install redis-6.2.0 \
diff --git a/30/apache/Dockerfile b/30/apache/Dockerfile
index e0ee6521..7b3f2939 100644
--- a/30/apache/Dockerfile
+++ b/30/apache/Dockerfile
@@ -1,9 +1,6 @@
 # DO NOT EDIT: created by update.sh from Dockerfile-debian.template
 FROM php:8.2-apache-bookworm
 
-# Define the commit hash for imagick as a variable
-ENV IMAGICK_COMMIT_HASH d7d3c24af1b4f599897408f1714600b69a56473b
-
 # entrypoint.sh and cron.sh dependencies
 RUN set -ex; \
     \
@@ -68,23 +65,10 @@ RUN set -ex; \
         zip \
     ; \
     \
-# The master version on the imagick repository is compatible with PHP 8.3. However, the PECL version is not updated yet.
-# As soon as it will get updated, we can switch back to the PECL version, instead of having this workaround.
-    curl -fsSL -o imagick.tar.gz "https://github.com/Imagick/imagick/archive/$IMAGICK_COMMIT_HASH.tar.gz"; \
-    tar -xzf imagick.tar.gz -C /tmp; \
-    rm imagick.tar.gz; \
-    cd "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    sed -i "s/@PACKAGE_VERSION@/git-$(echo ${IMAGICK_COMMIT_HASH} | cut -c 1-7)/" php_imagick.h; \
-    phpize; \
-    ./configure; \
-    make; \
-    make install; \
-    cd; \
-    rm -r "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    \
 # pecl will claim success even if one install fails, so we need to perform each install separately
     pecl install APCu-5.1.24; \
     pecl install igbinary-3.2.16; \
+    pecl install imagick-3.8.0; \
     pecl install memcached-3.3.0 \
         --configureoptions 'enable-memcached-igbinary="yes"'; \
     pecl install redis-6.2.0 \
diff --git a/30/fpm-alpine/Dockerfile b/30/fpm-alpine/Dockerfile
index 32ef9ca2..26c5c856 100644
--- a/30/fpm-alpine/Dockerfile
+++ b/30/fpm-alpine/Dockerfile
@@ -1,9 +1,6 @@
 # DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
 FROM php:8.2-fpm-alpine3.21
 
-# Define the commit hash for imagick as a variable
-ENV IMAGICK_COMMIT_HASH d7d3c24af1b4f599897408f1714600b69a56473b
-
 # entrypoint.sh and cron.sh dependencies
 RUN set -ex; \
     \
@@ -65,23 +62,10 @@ RUN set -ex; \
         zip \
     ; \
     \
-# The master version on the imagick repository is compatible with PHP 8.3. However, the PECL version is not updated yet.
-# As soon as it will get updated, we can switch back to the PECL version, instead of having this workaround.
-    curl -fsSL -o imagick.tar.gz "https://github.com/Imagick/imagick/archive/$IMAGICK_COMMIT_HASH.tar.gz"; \
-    tar -xzf imagick.tar.gz -C /tmp; \
-    rm imagick.tar.gz; \
-    cd "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    sed -i "s/@PACKAGE_VERSION@/git-$(echo ${IMAGICK_COMMIT_HASH} | cut -c 1-7)/" php_imagick.h; \
-    phpize; \
-    ./configure; \
-    make; \
-    make install; \
-    cd; \
-    rm -r "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    \
 # pecl will claim success even if one install fails, so we need to perform each install separately
     pecl install APCu-5.1.24; \
     pecl install igbinary-3.2.16; \
+    pecl install imagick-3.8.0; \
     pecl install memcached-3.3.0 \
         --configureoptions 'enable-memcached-igbinary="yes"'; \
     pecl install redis-6.2.0 \
diff --git a/30/fpm/Dockerfile b/30/fpm/Dockerfile
index 42fa3bc4..6ef1a6a7 100644
--- a/30/fpm/Dockerfile
+++ b/30/fpm/Dockerfile
@@ -1,9 +1,6 @@
 # DO NOT EDIT: created by update.sh from Dockerfile-debian.template
 FROM php:8.2-fpm-bookworm
 
-# Define the commit hash for imagick as a variable
-ENV IMAGICK_COMMIT_HASH d7d3c24af1b4f599897408f1714600b69a56473b
-
 # entrypoint.sh and cron.sh dependencies
 RUN set -ex; \
     \
@@ -68,23 +65,10 @@ RUN set -ex; \
         zip \
     ; \
     \
-# The master version on the imagick repository is compatible with PHP 8.3. However, the PECL version is not updated yet.
-# As soon as it will get updated, we can switch back to the PECL version, instead of having this workaround.
-    curl -fsSL -o imagick.tar.gz "https://github.com/Imagick/imagick/archive/$IMAGICK_COMMIT_HASH.tar.gz"; \
-    tar -xzf imagick.tar.gz -C /tmp; \
-    rm imagick.tar.gz; \
-    cd "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    sed -i "s/@PACKAGE_VERSION@/git-$(echo ${IMAGICK_COMMIT_HASH} | cut -c 1-7)/" php_imagick.h; \
-    phpize; \
-    ./configure; \
-    make; \
-    make install; \
-    cd; \
-    rm -r "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    \
 # pecl will claim success even if one install fails, so we need to perform each install separately
     pecl install APCu-5.1.24; \
     pecl install igbinary-3.2.16; \
+    pecl install imagick-3.8.0; \
     pecl install memcached-3.3.0 \
         --configureoptions 'enable-memcached-igbinary="yes"'; \
     pecl install redis-6.2.0 \
diff --git a/31/apache/Dockerfile b/31/apache/Dockerfile
index fa82eda7..642be03e 100644
--- a/31/apache/Dockerfile
+++ b/31/apache/Dockerfile
@@ -1,8 +1,5 @@
 # DO NOT EDIT: created by update.sh from Dockerfile-debian.template
-FROM php:8.3-apache-bookworm
-
-# Define the commit hash for imagick as a variable
-ENV IMAGICK_COMMIT_HASH d7d3c24af1b4f599897408f1714600b69a56473b
+FROM php:8.2-apache-bookworm
 
 # entrypoint.sh and cron.sh dependencies
 RUN set -ex; \
@@ -68,23 +65,10 @@ RUN set -ex; \
         zip \
     ; \
     \
-# The master version on the imagick repository is compatible with PHP 8.3. However, the PECL version is not updated yet.
-# As soon as it will get updated, we can switch back to the PECL version, instead of having this workaround.
-    curl -fsSL -o imagick.tar.gz "https://github.com/Imagick/imagick/archive/$IMAGICK_COMMIT_HASH.tar.gz"; \
-    tar -xzf imagick.tar.gz -C /tmp; \
-    rm imagick.tar.gz; \
-    cd "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    sed -i "s/@PACKAGE_VERSION@/git-$(echo ${IMAGICK_COMMIT_HASH} | cut -c 1-7)/" php_imagick.h; \
-    phpize; \
-    ./configure; \
-    make; \
-    make install; \
-    cd; \
-    rm -r "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    \
 # pecl will claim success even if one install fails, so we need to perform each install separately
     pecl install APCu-5.1.24; \
     pecl install igbinary-3.2.16; \
+    pecl install imagick-3.8.0; \
     pecl install memcached-3.3.0 \
         --configureoptions 'enable-memcached-igbinary="yes"'; \
     pecl install redis-6.2.0 \
diff --git a/31/fpm-alpine/Dockerfile b/31/fpm-alpine/Dockerfile
index 77cadc5b..0c9ff741 100644
--- a/31/fpm-alpine/Dockerfile
+++ b/31/fpm-alpine/Dockerfile
@@ -1,8 +1,5 @@
 # DO NOT EDIT: created by update.sh from Dockerfile-alpine.template
-FROM php:8.3-fpm-alpine3.21
-
-# Define the commit hash for imagick as a variable
-ENV IMAGICK_COMMIT_HASH d7d3c24af1b4f599897408f1714600b69a56473b
+FROM php:8.2-fpm-alpine3.21
 
 # entrypoint.sh and cron.sh dependencies
 RUN set -ex; \
@@ -65,23 +62,10 @@ RUN set -ex; \
         zip \
     ; \
     \
-# The master version on the imagick repository is compatible with PHP 8.3. However, the PECL version is not updated yet.
-# As soon as it will get updated, we can switch back to the PECL version, instead of having this workaround.
-    curl -fsSL -o imagick.tar.gz "https://github.com/Imagick/imagick/archive/$IMAGICK_COMMIT_HASH.tar.gz"; \
-    tar -xzf imagick.tar.gz -C /tmp; \
-    rm imagick.tar.gz; \
-    cd "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    sed -i "s/@PACKAGE_VERSION@/git-$(echo ${IMAGICK_COMMIT_HASH} | cut -c 1-7)/" php_imagick.h; \
-    phpize; \
-    ./configure; \
-    make; \
-    make install; \
-    cd; \
-    rm -r "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    \
 # pecl will claim success even if one install fails, so we need to perform each install separately
     pecl install APCu-5.1.24; \
     pecl install igbinary-3.2.16; \
+    pecl install imagick-3.8.0; \
     pecl install memcached-3.3.0 \
         --configureoptions 'enable-memcached-igbinary="yes"'; \
     pecl install redis-6.2.0 \
diff --git a/31/fpm/Dockerfile b/31/fpm/Dockerfile
index 0d25db84..9eee6cfc 100644
--- a/31/fpm/Dockerfile
+++ b/31/fpm/Dockerfile
@@ -1,8 +1,5 @@
 # DO NOT EDIT: created by update.sh from Dockerfile-debian.template
-FROM php:8.3-fpm-bookworm
-
-# Define the commit hash for imagick as a variable
-ENV IMAGICK_COMMIT_HASH d7d3c24af1b4f599897408f1714600b69a56473b
+FROM php:8.2-fpm-bookworm
 
 # entrypoint.sh and cron.sh dependencies
 RUN set -ex; \
@@ -68,23 +65,10 @@ RUN set -ex; \
         zip \
     ; \
     \
-# The master version on the imagick repository is compatible with PHP 8.3. However, the PECL version is not updated yet.
-# As soon as it will get updated, we can switch back to the PECL version, instead of having this workaround.
-    curl -fsSL -o imagick.tar.gz "https://github.com/Imagick/imagick/archive/$IMAGICK_COMMIT_HASH.tar.gz"; \
-    tar -xzf imagick.tar.gz -C /tmp; \
-    rm imagick.tar.gz; \
-    cd "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    sed -i "s/@PACKAGE_VERSION@/git-$(echo ${IMAGICK_COMMIT_HASH} | cut -c 1-7)/" php_imagick.h; \
-    phpize; \
-    ./configure; \
-    make; \
-    make install; \
-    cd; \
-    rm -r "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    \
 # pecl will claim success even if one install fails, so we need to perform each install separately
     pecl install APCu-5.1.24; \
     pecl install igbinary-3.2.16; \
+    pecl install imagick-3.8.0; \
     pecl install memcached-3.3.0 \
         --configureoptions 'enable-memcached-igbinary="yes"'; \
     pecl install redis-6.2.0 \
diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template
index 2295bddf..cf6af0ff 100644
--- a/Dockerfile-alpine.template
+++ b/Dockerfile-alpine.template
@@ -1,8 +1,5 @@
 FROM php:%%PHP_VERSION%%-%%VARIANT%%%%ALPINE_VERSION%%
 
-# Define the commit hash for imagick as a variable
-ENV IMAGICK_COMMIT_HASH d7d3c24af1b4f599897408f1714600b69a56473b
-
 # entrypoint.sh and cron.sh dependencies
 RUN set -ex; \
     \
@@ -64,23 +61,10 @@ RUN set -ex; \
         zip \
     ; \
     \
-# The master version on the imagick repository is compatible with PHP 8.3. However, the PECL version is not updated yet.
-# As soon as it will get updated, we can switch back to the PECL version, instead of having this workaround.
-    curl -fsSL -o imagick.tar.gz "https://github.com/Imagick/imagick/archive/$IMAGICK_COMMIT_HASH.tar.gz"; \
-    tar -xzf imagick.tar.gz -C /tmp; \
-    rm imagick.tar.gz; \
-    cd "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    sed -i "s/@PACKAGE_VERSION@/git-$(echo ${IMAGICK_COMMIT_HASH} | cut -c 1-7)/" php_imagick.h; \
-    phpize; \
-    ./configure; \
-    make; \
-    make install; \
-    cd; \
-    rm -r "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    \
 # pecl will claim success even if one install fails, so we need to perform each install separately
     pecl install APCu-%%APCU_VERSION%%; \
     pecl install igbinary-%%IGBINARY_VERSION%%; \
+    pecl install imagick-%%IMAGICK_VERSION%%; \
     pecl install memcached-%%MEMCACHED_VERSION%% \
         --configureoptions 'enable-memcached-igbinary="yes"'; \
     pecl install redis-%%REDIS_VERSION%% \
diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template
index 8734caa9..cadae18a 100644
--- a/Dockerfile-debian.template
+++ b/Dockerfile-debian.template
@@ -1,8 +1,5 @@
 FROM php:%%PHP_VERSION%%-%%VARIANT%%-%%DEBIAN_VERSION%%
 
-# Define the commit hash for imagick as a variable
-ENV IMAGICK_COMMIT_HASH d7d3c24af1b4f599897408f1714600b69a56473b
-
 # entrypoint.sh and cron.sh dependencies
 RUN set -ex; \
     \
@@ -67,23 +64,10 @@ RUN set -ex; \
         zip \
     ; \
     \
-# The master version on the imagick repository is compatible with PHP 8.3. However, the PECL version is not updated yet.
-# As soon as it will get updated, we can switch back to the PECL version, instead of having this workaround.
-    curl -fsSL -o imagick.tar.gz "https://github.com/Imagick/imagick/archive/$IMAGICK_COMMIT_HASH.tar.gz"; \
-    tar -xzf imagick.tar.gz -C /tmp; \
-    rm imagick.tar.gz; \
-    cd "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    sed -i "s/@PACKAGE_VERSION@/git-$(echo ${IMAGICK_COMMIT_HASH} | cut -c 1-7)/" php_imagick.h; \
-    phpize; \
-    ./configure; \
-    make; \
-    make install; \
-    cd; \
-    rm -r "/tmp/imagick-$IMAGICK_COMMIT_HASH"; \
-    \
 # pecl will claim success even if one install fails, so we need to perform each install separately
     pecl install APCu-%%APCU_VERSION%%; \
     pecl install igbinary-%%IGBINARY_VERSION%%; \
+    pecl install imagick-%%IMAGICK_VERSION%%; \
     pecl install memcached-%%MEMCACHED_VERSION%% \
         --configureoptions 'enable-memcached-igbinary="yes"'; \
     pecl install redis-%%REDIS_VERSION%% \
diff --git a/update.sh b/update.sh
index 0f224b06..de9670b3 100755
--- a/update.sh
+++ b/update.sh
@@ -11,7 +11,6 @@ declare -A debian_version=(
 
 declare -A php_version=(
 	[default]='8.2'
-	[31]='8.3'
 )
 
 declare -A cmd=(
@@ -55,7 +54,7 @@ igbinary_version="$(
 )"
 
 imagick_version="$(
-	git ls-remote --tags https://github.com/mkoppanen/imagick.git \
+	git ls-remote --tags https://github.com/imagick/imagick.git \
 		| cut -d/ -f3 \
 		| grep -viE '[a-z]' \
 		| tr -d '^{}' \
diff --git a/versions.json b/versions.json
index 1680b69a..2bfbfa63 100644
--- a/versions.json
+++ b/versions.json
@@ -9,19 +9,19 @@
         "variant": "apache",
         "base": "debian",
         "baseVersion": "bookworm",
-        "phpVersion": "8.3"
+        "phpVersion": "8.2"
       },
       "fpm": {
         "variant": "fpm",
         "base": "debian",
         "baseVersion": "bookworm",
-        "phpVersion": "8.3"
+        "phpVersion": "8.2"
       },
       "fpm-alpine": {
         "variant": "fpm-alpine",
         "base": "alpine",
         "baseVersion": "3.21",
-        "phpVersion": "8.3"
+        "phpVersion": "8.2"
       }
     }
   },
-- 
GitLab