From 098501aaed1dfcffaef42dbe1184956924e7cd3c Mon Sep 17 00:00:00 2001
From: Stephane de Labrusse <stephdl@de-labrusse.fr>
Date: Mon, 11 Mar 2024 23:20:24 +0100
Subject: [PATCH 1/2] Add WordPress app container and update image references

build with pdo_mysql
---
 build-images.sh | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/build-images.sh b/build-images.sh
index f1cb647..6130ac4 100644
--- a/build-images.sh
+++ b/build-images.sh
@@ -12,12 +12,26 @@ set -e
 images=()
 # The image will be pushed to GitHub container registry
 repobase="${REPOBASE:-ghcr.io/nethserver}"
+wordpress_version="6.4.3-php8.3-apache"
+#Create webtop-webapp container
+reponame="wordpress-app"
+container=$(buildah from docker.io/wordpress:${wordpress_version})
+buildah run "${container}" /bin/sh <<'EOF'
+set -e
+docker-php-ext-install pdo_mysql
+EOF
+# Commit the image
+buildah commit --rm "${container}" "${repobase}/${reponame}"
+
+# Append the image URL to the images array
+images+=("${repobase}/${reponame}")
+
+
 # Configure the image name
 reponame="wordpress"
 
 # Create a new empty container image
 container=$(buildah from scratch)
-
 # Reuse existing nodebuilder-wordpress container, to speed up builds
 if ! buildah containers --format "{{.ContainerName}}" | grep -q nodebuilder-wordpress; then
     echo "Pulling NodeJS runtime..."
@@ -45,7 +59,7 @@ buildah config --entrypoint=/ \
     --label="org.nethserver.authorizations=traefik@node:routeadm" \
     --label="org.nethserver.tcp-ports-demand=3" \
     --label="org.nethserver.rootfull=0" \
-    --label="org.nethserver.images=docker.io/mariadb:10.11.5 docker.io/wordpress:6.4.3-php8.3-apache" \
+    --label="org.nethserver.images=docker.io/mariadb:10.11.5 ${repobase}/wordpress-app:${IMAGETAG:-latest}" \
     "${container}"
 # Commit the image
 buildah commit "${container}" "${repobase}/${reponame}"

From ed0007935b2132dda1f5bebc51fc10b61c4b20ad Mon Sep 17 00:00:00 2001
From: Stephane de Labrusse <stephdl@de-labrusse.fr>
Date: Mon, 11 Mar 2024 23:26:55 +0100
Subject: [PATCH 2/2] Update WordPress app image name in systemd service file

---
 imageroot/systemd/user/wordpress-app.service | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/imageroot/systemd/user/wordpress-app.service b/imageroot/systemd/user/wordpress-app.service
index 49d33f1..4e47c85 100644
--- a/imageroot/systemd/user/wordpress-app.service
+++ b/imageroot/systemd/user/wordpress-app.service
@@ -39,7 +39,7 @@ ExecStart=/usr/bin/podman run --conmon-pidfile %t/wordpress-app.pid \
     --env WORDPRESS_SECURE_AUTH_SALT="${SECRET}" \
     --env WORDPRESS_LOGGED_IN_SALT="${SECRET}" \
     --env WORDPRESS_NONCE_SALT="${SECRET}" \
-    ${WORDPRESS_IMAGE}
+    ${WORDPRESS_APP_IMAGE}
 ExecStop=/usr/bin/podman stop --ignore --cidfile %t/wordpress-app.ctr-id -t 10
 ExecReload=/usr/bin/podman kill -s HUP wordpress-app
 SyslogIdentifier=%u