From b940d813f9c37b08bd56e20ff43d34f72ea1e26c Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Sun, 22 Jan 2023 11:44:20 +0000
Subject: [PATCH] Bookworm build (PHP 8.2)

Based on apache2-base:bookworm for now.
---
 Dockerfile                                                | 2 +-
 build.sh                                                  | 2 +-
 conf/php/7.4/fpm/php-fpm.conf                             | 6 ------
 conf/php/{7.4 => 8.2}/fpm/conf.d/50-container-openssl.ini | 0
 conf/php/8.2/fpm/php-fpm.conf                             | 6 ++++++
 conf/php/{7.4 => 8.2}/fpm/pool.d/www.conf                 | 2 +-
 conf/services.d/php-fpm-exporter/run                      | 2 +-
 conf/services.d/php-fpm/run                               | 2 +-
 8 files changed, 11 insertions(+), 11 deletions(-)
 delete mode 100644 conf/php/7.4/fpm/php-fpm.conf
 rename conf/php/{7.4 => 8.2}/fpm/conf.d/50-container-openssl.ini (100%)
 create mode 100644 conf/php/8.2/fpm/php-fpm.conf
 rename conf/php/{7.4 => 8.2}/fpm/pool.d/www.conf (95%)

diff --git a/Dockerfile b/Dockerfile
index edab896..c12321b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM registry.git.autistici.org/ai3/docker/apache2-base:master
+FROM registry.git.autistici.org/ai3/docker/apache2-base:bookworm
 
 COPY conf /tmp/conf
 COPY build.sh /tmp/build.sh
diff --git a/build.sh b/build.sh
index e1a54f6..94e05fc 100755
--- a/build.sh
+++ b/build.sh
@@ -43,7 +43,7 @@ echo "export PHP_FPM_EXPORTER_PORT=\`expr \$APACHE_PORT + 200\`" >> /etc/apache2
 
 # Enable php configuration.
 a2enmod proxy_fcgi setenvif
-a2enconf -q php7.4-fpm
+a2enconf -q php8.2-fpm
 
 # Rsync our configuration, on top of /etc.
 rsync -a /tmp/conf/ /etc/
diff --git a/conf/php/7.4/fpm/php-fpm.conf b/conf/php/7.4/fpm/php-fpm.conf
deleted file mode 100644
index c112e62..0000000
--- a/conf/php/7.4/fpm/php-fpm.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-[global]
-pid = /run/php/php7.4-fpm.pid
-error_log = /dev/fd/2
-systemd_interval = 0
-
-include=/etc/php/7.4/fpm/pool.d/*.conf
diff --git a/conf/php/7.4/fpm/conf.d/50-container-openssl.ini b/conf/php/8.2/fpm/conf.d/50-container-openssl.ini
similarity index 100%
rename from conf/php/7.4/fpm/conf.d/50-container-openssl.ini
rename to conf/php/8.2/fpm/conf.d/50-container-openssl.ini
diff --git a/conf/php/8.2/fpm/php-fpm.conf b/conf/php/8.2/fpm/php-fpm.conf
new file mode 100644
index 0000000..cc2f682
--- /dev/null
+++ b/conf/php/8.2/fpm/php-fpm.conf
@@ -0,0 +1,6 @@
+[global]
+pid = /run/php/php8.2-fpm.pid
+error_log = /dev/fd/2
+systemd_interval = 0
+
+include=/etc/php/8.2/fpm/pool.d/*.conf
diff --git a/conf/php/7.4/fpm/pool.d/www.conf b/conf/php/8.2/fpm/pool.d/www.conf
similarity index 95%
rename from conf/php/7.4/fpm/pool.d/www.conf
rename to conf/php/8.2/fpm/pool.d/www.conf
index e56fed2..ec0bc09 100644
--- a/conf/php/7.4/fpm/pool.d/www.conf
+++ b/conf/php/8.2/fpm/pool.d/www.conf
@@ -1,5 +1,5 @@
 [www]
-listen = /run/php/php7.4-fpm.sock
+listen = /run/php/php8.2-fpm.sock
 
 pm = dynamic
 pm.max_children = 20
diff --git a/conf/services.d/php-fpm-exporter/run b/conf/services.d/php-fpm-exporter/run
index 170723d..365ea35 100755
--- a/conf/services.d/php-fpm-exporter/run
+++ b/conf/services.d/php-fpm-exporter/run
@@ -1,4 +1,4 @@
 #!/bin/sh
 . /etc/apache2/envvars
 export HOME=/
-exec /usr/sbin/php-fpm-exporter server "--phpfpm.scrape-uri=unix:///run/php/php7.4-fpm.sock;/status" --web.listen-address=:$PHP_FPM_EXPORTER_PORT --phpfpm.fix-process-count
+exec /usr/sbin/php-fpm-exporter server "--phpfpm.scrape-uri=unix:///run/php/php8.2-fpm.sock;/status" --web.listen-address=:$PHP_FPM_EXPORTER_PORT --phpfpm.fix-process-count
diff --git a/conf/services.d/php-fpm/run b/conf/services.d/php-fpm/run
index 55fd8d5..14b9e83 100755
--- a/conf/services.d/php-fpm/run
+++ b/conf/services.d/php-fpm/run
@@ -1,3 +1,3 @@
 #!/bin/sh
 mkdir -p /run/php
-exec /usr/sbin/php-fpm7.4 --force-stderr --nodaemonize
+exec /usr/sbin/php-fpm8.2 --force-stderr --nodaemonize
-- 
GitLab