commit 21b3aed27ac92d1f68f3ce5b1c1bdc356bef5a66
parent 72a154e46f4a6920592545f8d65fb24977460738
Author: MTRNord <MTRNord@users.noreply.github.com>
Date: Fri, 17 Apr 2026 22:06:55 +0200
fix image
Signed-off-by: MTRNord <MTRNord@users.noreply.github.com>
Diffstat:
6 files changed, 84 insertions(+), 13 deletions(-)
diff --git a/.github/workflows/build-mediawiki.yaml b/.github/workflows/build-mediawiki.yaml
@@ -6,6 +6,9 @@ on:
paths:
- "apps/talos_cluster/mediawiki/Dockerfile"
- "apps/talos_cluster/mediawiki/php-custom.ini"
+ - "apps/talos_cluster/mediawiki/apache-vhost.conf"
+ - "apps/talos_cluster/mediawiki/apache-fpm.conf"
+ - "apps/talos_cluster/mediawiki/fpm-pool.conf"
- "apps/talos_cluster/mediawiki/docker-entrypoint.sh"
- ".github/workflows/build-mediawiki.yaml"
schedule:
diff --git a/apps/talos_cluster/mediawiki/Dockerfile b/apps/talos_cluster/mediawiki/Dockerfile
@@ -1,25 +1,43 @@
ARG MEDIAWIKI_VERSION=1.45.3
-FROM mediawiki:${MEDIAWIKI_VERSION}
+FROM mediawiki:${MEDIAWIKI_VERSION} AS mediawiki-src
-RUN apt-get update && apt-get install -y --no-install-recommends \
- librsvg2-bin \
- python3-pygments \
- git \
- php8.3-fpm \
+# Add CodeMirror while git is available in the source image
+RUN apt-get update && apt-get install -y --no-install-recommends git \
&& git clone --depth 1 --branch REL1_45 \
https://github.com/wikimedia/mediawiki-extensions-CodeMirror.git \
/var/www/html/extensions/CodeMirror \
&& rm -rf /var/www/html/extensions/CodeMirror/.git \
- && pecl install redis \
- && docker-php-ext-enable apcu redis \
- && a2enmod proxy_fcgi setenvif mpm_event \
- && a2dismod mpm_prefork \
- && a2enconf php8.3-fpm \
&& apt-get purge -y git && apt-get autoremove -y \
+ && rm -rf /var/lib/apt/lists/*
+
+FROM php:8.3-fpm-bookworm
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ apache2 \
+ librsvg2-bin \
+ python3-pygments \
+ libicu-dev \
+ libonig-dev \
+ liblua5.1-dev \
+ && docker-php-ext-install -j$(nproc) calendar intl mbstring mysqli opcache \
+ && pecl install apcu redis \
+ && docker-php-ext-enable apcu redis \
+ && pecl install LuaSandbox \
+ && docker-php-ext-enable luasandbox \
+ && a2enmod rewrite proxy_fcgi setenvif mpm_event \
+ && a2dismod mpm_prefork || true \
&& rm -rf /var/lib/apt/lists/* /tmp/pear
+COPY --from=mediawiki-src /var/www/html /var/www/html
+COPY --from=mediawiki-src /var/www/data /var/www/data
+
+COPY apache-vhost.conf /etc/apache2/sites-enabled/000-default.conf
+COPY apache-fpm.conf /etc/apache2/conf-enabled/php-fpm.conf
+COPY fpm-pool.conf /usr/local/etc/php-fpm.d/zz-mediawiki.conf
COPY php-custom.ini /usr/local/etc/php/conf.d/zz-mediawiki-custom.ini
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
+
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
+EXPOSE 80
CMD ["/usr/local/bin/docker-entrypoint.sh"]
diff --git a/apps/talos_cluster/mediawiki/apache-fpm.conf b/apps/talos_cluster/mediawiki/apache-fpm.conf
@@ -0,0 +1,11 @@
+<FilesMatch \.php$>
+ SetHandler "proxy:fcgi://127.0.0.1:9000"
+</FilesMatch>
+
+DirectoryIndex disabled
+DirectoryIndex index.php index.html
+
+<Directory /var/www/>
+ Options -Indexes
+ AllowOverride All
+</Directory>
diff --git a/apps/talos_cluster/mediawiki/apache-vhost.conf b/apps/talos_cluster/mediawiki/apache-vhost.conf
@@ -0,0 +1,19 @@
+<VirtualHost *:80>
+ ServerName wiki.mtrnord.blog
+ DocumentRoot /var/www/html
+
+ AllowEncodedSlashes NoDecode
+
+ <Directory /var/www/html>
+ Options -Indexes +FollowSymLinks
+ AllowOverride All
+ Require all granted
+ </Directory>
+
+ RewriteEngine On
+ RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L]
+ RewriteRule ^/?$ %{DOCUMENT_ROOT}/index.php [L]
+
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
+</VirtualHost>
diff --git a/apps/talos_cluster/mediawiki/docker-entrypoint.sh b/apps/talos_cluster/mediawiki/docker-entrypoint.sh
@@ -1,4 +1,9 @@
#!/bin/bash
set -e
-php-fpm8.3 --daemonize
-exec apache2-foreground
+
+# Start PHP-FPM as a daemon
+/usr/local/sbin/php-fpm --daemonize
+
+# Source Apache environment variables then run Apache in foreground
+. /etc/apache2/envvars
+exec /usr/sbin/apache2 -DFOREGROUND
diff --git a/apps/talos_cluster/mediawiki/fpm-pool.conf b/apps/talos_cluster/mediawiki/fpm-pool.conf
@@ -0,0 +1,15 @@
+[www]
+user = www-data
+group = www-data
+
+listen = 127.0.0.1:9000
+
+pm = dynamic
+pm.max_children = 20
+pm.start_servers = 4
+pm.min_spare_servers = 2
+pm.max_spare_servers = 6
+pm.max_requests = 500
+
+; Pass environment variables to FPM workers
+clear_env = no