Add some complications to MediaWiki image
All checks were successful
ci/woodpecker/push/mediawiki Pipeline was successful
ci/woodpecker/tag/mediawiki Pipeline was successful

This commit is contained in:
Fritz Grimpen 2024-11-10 02:59:31 +01:00
parent 990ca64225
commit 7184e94feb
4 changed files with 82 additions and 32 deletions

View file

@ -5,36 +5,39 @@ WORKDIR /usr/src
RUN apk update && apk add git
ADD https://releases.wikimedia.org/mediawiki/1.42/mediawiki-1.42.3.tar.gz .
RUN tar -xzf mediawiki-1.42.3.tar.gz
RUN tar -xzf mediawiki-1.42.3.tar.gz && mv mediawiki-1.42.3 mediawiki
RUN git clone -b REL1_42 https://gerrit.wikimedia.org/r/mediawiki/extensions/MobileFrontend; \
rm -rf MobileFrontend/.git
WORKDIR /usr/src/mediawiki
RUN git clone -b REL1_42 https://gerrit.wikimedia.org/r/mediawiki/extensions/PluggableAuth; \
rm -rf PluggableAuth/.git
RUN git clone -b REL1_42 https://gerrit.wikimedia.org/r/mediawiki/extensions/MobileFrontend extensions/MobileFrontend; \
rm -rf extensions/MobileFrontend/.git
RUN git clone -b REL1_42 https://gerrit.wikimedia.org/r/mediawiki/extensions/OpenIDConnect; \
rm -rf OpenIDConnect/.git
RUN git clone -b REL1_42 https://gerrit.wikimedia.org/r/mediawiki/extensions/PluggableAuth extensions/PluggableAuth; \
rm -rf extensions/PluggableAuth/.git
RUN git clone -b REL1_42 https://gerrit.wikimedia.org/r/mediawiki/extensions/Widgets; \
rm -rf Widgets/.git
RUN git clone -b REL1_42 https://gerrit.wikimedia.org/r/mediawiki/extensions/OpenIDConnect extensions/OpenIDConnect; \
rm -rf extensions/OpenIDConnect/.git
RUN git clone -b REL1_42 https://gerrit.wikimedia.org/r/mediawiki/extensions/Widgets extensions/Widgets; \
rm -rf extensions/Widgets/.git
FROM docker.io/library/unit:php8.2
WORKDIR /var/www/html
RUN apt-get update && apt-get install -y \
libicu-dev librsvg2-bin \
&& docker-php-ext-configure intl \
&& docker-php-ext-install -j$(nproc) intl \
&& docker-php-ext-install -j$(nproc) mysqli \
&& apt-get install -y imagemagick \
libicu-dev librsvg2-bin imagemagick git unzip \
&& rm -rf /var/lib/apt/lists/*
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 --from=builder --chown=unit:unit /usr/src/Widgets w/extensions/Widgets
RUN docker-php-ext-configure intl \
&& docker-php-ext-install -j$(nproc) intl \
&& docker-php-ext-install -j$(nproc) mysqli \
&& docker-php-ext-install -j$(nproc) calendar
COPY --from=builder --chown=unit:unit /usr/src/mediawiki w/
COPY --from=docker.io/composer/composer /usr/bin/composer /usr/bin/composer
COPY composer.local.json w/composer.local.json
RUN cd /var/www/html/w && composer update --no-dev
COPY config.json /docker-entrypoint.d/config.json

26
mediawiki/README.md Normal file
View file

@ -0,0 +1,26 @@
# MediaWiki OCI image
This MediaWiki OCI image is based on NGINX Unit and bundles several extensions, which are in use in wiki.ccchb.de.
## Bundled extensions
* MobileFrontend
* PluggableAuth
* OpenIDConnect
* Widgets
## Ingress
The image exposes an HTTP service under port 80.
The MediaWiki installation is available below `/w/` and provides article paths below the path `/wiki/`.
A redirect at `/` is not provided by the image, and has to be implemented by the ingress.
## Volumes
It is recommended to mount a volume at `/var/www/html/w/images/` for MediaWiki uploads.
## Configuration
The MediaWiki installation expects a LocalSettings.php configuration file at the path `/var/www/html/w/LocalSettings.php`.
Happy helming!

View file

@ -0,0 +1,7 @@
{
"extra": {
"merge-plugin": {
"include": ["extensions/*/composer.json", "skins/*/composer.json"]
}
}
}

View file

@ -8,42 +8,56 @@
{
"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"
"/w/index.php*",
"/w/load.php*",
"/w/api.php*",
"/w/thumb.php*",
"/w/opensearch_desc.php*",
"/w/rest.php*",
"/w/img_auth.php*"
]
},
"action": {
"pass": "applications/php_app"
"pass": "applications/php_app/direct"
}
},
{
"match": {
"uri": [
"!*.php",
"/w/images/*",
"/w/resources/assets/*",
"/w/resources/lib/*",
"/w/resources/src/*",
"/w/extensions/*",
"/w/skins/*",
"favicon.ico"
"/w/skins/*"
]
},
"action": {
"share": "/var/www/html$uri"
}
},
{
"match": {
"uri": ["/wiki/*"]
},
"action": {
"pass": "applications/php_app/index"
}
}
],
"applications": {
"php_app": {
"type": "php",
"root": "/var/www/html"
"targets": {
"direct": {
"root": "/var/www/html"
},
"index": {
"root": "/var/www/html",
"script": "w/index.php"
}
}
}
}
}