From c781d79ed25bcfa131d357d2afeaaaf5bd1da60f Mon Sep 17 00:00:00 2001 From: Fritz Grimpen Date: Sat, 26 Oct 2024 19:09:50 +0200 Subject: [PATCH] Redesign mediawiki container --- mediawiki/Containerfile | 37 ++++++++++++++++++++++--------- mediawiki/config.json | 48 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 10 deletions(-) create mode 100644 mediawiki/config.json diff --git a/mediawiki/Containerfile b/mediawiki/Containerfile index 6008922..4456c6d 100644 --- a/mediawiki/Containerfile +++ b/mediawiki/Containerfile @@ -1,17 +1,34 @@ FROM alpine AS builder -ADD https://extdist.wmflabs.org/dist/extensions/MobileFrontend-REL1_42-a9969ab.tar.gz /usr/src/ -RUN tar -xz -C /usr/src -f /usr/src/MobileFrontend-REL1_42-a9969ab.tar.gz +WORKDIR /usr/src -ADD https://extdist.wmflabs.org/dist/extensions/PluggableAuth-REL1_42-b35addc.tar.gz /usr/src/ -RUN tar -xz -C /usr/src -f /usr/src/PluggableAuth-REL1_42-b35addc.tar.gz +ADD https://releases.wikimedia.org/mediawiki/1.42/mediawiki-1.42.3.tar.gz . +RUN tar -xzf mediawiki-1.42.3.tar.gz -ADD https://extdist.wmflabs.org/dist/extensions/OpenIDConnect-REL1_42-83024de.tar.gz /usr/src/ -RUN tar -xz -C /usr/src -f /usr/src/OpenIDConnect-REL1_42-83024de.tar.gz +ADD https://extdist.wmflabs.org/dist/extensions/MobileFrontend-REL1_42-8a4ecb7.tar.gz . +RUN tar -xzf MobileFrontend-REL1_42-8a4ecb7.tar.gz -FROM docker.io/mediawiki:1.42.3-fpm-alpine +ADD https://extdist.wmflabs.org/dist/extensions/PluggableAuth-REL1_42-b35addc.tar.gz . +RUN tar -xzf PluggableAuth-REL1_42-b35addc.tar.gz -COPY --from=builder --chown=www-data:www-data /usr/src/MobileFrontend extensions/MobileFrontend -COPY --from=builder --chown=www-data:www-data /usr/src/PluggableAuth extensions/PluggableAuth -COPY --from=builder --chown=www-data:www-data /usr/src/OpenIDConnect extensions/OpenIDConnect +ADD https://extdist.wmflabs.org/dist/extensions/OpenIDConnect-REL1_42-83024de.tar.gz . +RUN tar -xzf OpenIDConnect-REL1_42-83024de.tar.gz +FROM docker.io/library/unit:php8.2 + +WORKDIR /var/www/html + +RUN apt-get update && apt-get install -y \ + libicu-dev \ + && docker-php-ext-configure intl \ + && docker-php-ext-install -j$(nproc) intl +RUN docker-php-ext-configure mysqli \ + && docker-php-ext-install -j$(nproc) mysqli +RUN apt-get install -y imagemagick + +COPY --from=builder --chown=unit:unit /usr/src/mediawiki-1.42.3 w/ +COPY --from=builder --chown=unit:unit /usr/src/MobileFrontend w/extensions/MobileFrontend +COPY --from=builder --chown=unit:unit /usr/src/PluggableAuth w/extensions/PluggableAuth +COPY --from=builder --chown=unit:unit /usr/src/OpenIDConnect w/extensions/OpenIDConnect + +COPY config.json /docker-entrypoint.d/config.json diff --git a/mediawiki/config.json b/mediawiki/config.json new file mode 100644 index 0000000..0f79bfa --- /dev/null +++ b/mediawiki/config.json @@ -0,0 +1,48 @@ +{ + "listeners": { + "*:80": { + "pass": "routes" + } + }, + "routes": [ + { + "match": { + "uri": [ + "/w/index.php", + "/w/load.php", + "/w/api.php", + "/w/thumb.php", + "/w/opensearch_desc.php", + "/w/rest.php", + "/w/img_auth.php", + "/w/rest.php/*", + "/w/mw-config/*.php" + ] + }, + "action": { + "pass": "applications/php_app" + } + }, + { + "match": { + "uri": [ + "/w/images/*", + "/w/resources/assets/*", + "/w/resources/lib/*", + "/w/resources/src/*", + "/w/extensions/*", + "/w/skins/*" + ] + }, + "action": { + "share": "/var/www/html$uri" + } + } + ], + "applications": { + "php_app": { + "type": "php", + "root": "/var/www/html" + } + } +}