Skip to content

Commit

Permalink
Add mediawiki 1.41
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-heusel committed Dec 23, 2023
1 parent e1062da commit af2e5da
Show file tree
Hide file tree
Showing 4 changed files with 309 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
version: ['1.35', '1.39', '1.40']
version: ['1.35', '1.39', '1.40', '1.41']
type: [apache, fpm, fpm-alpine]

steps:
Expand Down
117 changes: 117 additions & 0 deletions 1.41/apache/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
FROM php:8.1-apache

# System dependencies
RUN set -eux; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
git \
librsvg2-bin \
imagemagick \
# Required for SyntaxHighlighting
python3 \
; \
rm -rf /var/lib/apt/lists/*

# Install the PHP extensions we need
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libicu-dev \
libonig-dev \
; \
\
docker-php-ext-install -j "$(nproc)" \
calendar \
intl \
mbstring \
mysqli \
opcache \
; \
\
pecl install APCu-5.1.21; \
docker-php-ext-enable \
apcu \
; \
rm -r /tmp/pear; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*

# Enable Short URLs
RUN set -eux; \
a2enmod rewrite; \
{ \
echo "<Directory /var/www/html>"; \
echo " RewriteEngine On"; \
echo " RewriteCond %{REQUEST_FILENAME} !-f"; \
echo " RewriteCond %{REQUEST_FILENAME} !-d"; \
echo " RewriteRule ^ %{DOCUMENT_ROOT}/index.php [L]"; \
echo "</Directory>"; \
} > "$APACHE_CONFDIR/conf-available/short-url.conf"; \
a2enconf short-url

# Enable AllowEncodedSlashes for VisualEditor
RUN sed -i "s/<\/VirtualHost>/\tAllowEncodedSlashes NoDecode\n<\/VirtualHost>/" "$APACHE_CONFDIR/sites-available/000-default.conf"

# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini

# SQLite Directory Setup
RUN set -eux; \
mkdir -p /var/www/data; \
chown -R www-data:www-data /var/www/data

# Version
ENV MEDIAWIKI_MAJOR_VERSION 1.41
ENV MEDIAWIKI_VERSION 1.41.0

# MediaWiki setup
RUN set -eux; \
fetchDeps=" \
gnupg \
dirmngr \
"; \
apt-get update; \
apt-get install -y --no-install-recommends $fetchDeps; \
\
curl -fSL "https://releases.wikimedia.org/mediawiki/${MEDIAWIKI_MAJOR_VERSION}/mediawiki-${MEDIAWIKI_VERSION}.tar.gz" -o mediawiki.tar.gz; \
curl -fSL "https://releases.wikimedia.org/mediawiki/${MEDIAWIKI_MAJOR_VERSION}/mediawiki-${MEDIAWIKI_VERSION}.tar.gz.sig" -o mediawiki.tar.gz.sig; \
export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://www.mediawiki.org/keys/keys.txt
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys \
D7D6767D135A514BEB86E9BA75682B08E8A3FEC4 \
441276E9CCD15F44F6D97D18C119E1A64D70938E \
F7F780D82EBFB8A56556E7EE82403E59F9F8CD79 \
1D98867E82982C8FE0ABC25F9B69B3109D3BB7B0 \
; \
gpg --batch --verify mediawiki.tar.gz.sig mediawiki.tar.gz; \
tar -x --strip-components=1 -f mediawiki.tar.gz; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" mediawiki.tar.gz.sig mediawiki.tar.gz; \
chown -R www-data:www-data extensions skins cache images; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
rm -rf /var/lib/apt/lists/*

CMD ["apache2-foreground"]
89 changes: 89 additions & 0 deletions 1.41/fpm-alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
FROM php:8.1-fpm-alpine

# System dependencies
RUN set -eux; \
\
apk add --no-cache \
git \
imagemagick \
# Required for SyntaxHighlighting
python3 \
;

# Install the PHP extensions we need
RUN set -eux; \
\
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
icu-dev \
oniguruma-dev \
; \
\
docker-php-ext-install -j "$(nproc)" \
calendar \
intl \
mbstring \
mysqli \
opcache \
; \
\
pecl install APCu-5.1.21; \
docker-php-ext-enable \
apcu \
; \
rm -r /tmp/pear; \
\
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --no-network --virtual .mediawiki-phpext-rundeps $runDeps; \
apk del --no-network .build-deps

# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
echo 'opcache.fast_shutdown=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini

# SQLite Directory Setup
RUN set -eux; \
mkdir -p /var/www/data; \
chown -R www-data:www-data /var/www/data

# Version
ENV MEDIAWIKI_MAJOR_VERSION 1.41
ENV MEDIAWIKI_VERSION 1.41.0

# MediaWiki setup
RUN set -eux; \
apk add --no-cache --virtual .fetch-deps \
bzip2 \
gnupg \
; \
\
curl -fSL "https://releases.wikimedia.org/mediawiki/${MEDIAWIKI_MAJOR_VERSION}/mediawiki-${MEDIAWIKI_VERSION}.tar.gz" -o mediawiki.tar.gz; \
curl -fSL "https://releases.wikimedia.org/mediawiki/${MEDIAWIKI_MAJOR_VERSION}/mediawiki-${MEDIAWIKI_VERSION}.tar.gz.sig" -o mediawiki.tar.gz.sig; \
export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://www.mediawiki.org/keys/keys.txt
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys \
D7D6767D135A514BEB86E9BA75682B08E8A3FEC4 \
441276E9CCD15F44F6D97D18C119E1A64D70938E \
F7F780D82EBFB8A56556E7EE82403E59F9F8CD79 \
1D98867E82982C8FE0ABC25F9B69B3109D3BB7B0 \
; \
gpg --batch --verify mediawiki.tar.gz.sig mediawiki.tar.gz; \
tar -x --strip-components=1 -f mediawiki.tar.gz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME" mediawiki.tar.gz.sig mediawiki.tar.gz; \
chown -R www-data:www-data extensions skins cache images; \
\
apk del --no-network .fetch-deps

CMD ["php-fpm"]
102 changes: 102 additions & 0 deletions 1.41/fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
FROM php:8.1-fpm

# System dependencies
RUN set -eux; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
git \
librsvg2-bin \
imagemagick \
# Required for SyntaxHighlighting
python3 \
; \
rm -rf /var/lib/apt/lists/*

# Install the PHP extensions we need
RUN set -eux; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libicu-dev \
libonig-dev \
; \
\
docker-php-ext-install -j "$(nproc)" \
calendar \
intl \
mbstring \
mysqli \
opcache \
; \
\
pecl install APCu-5.1.21; \
docker-php-ext-enable \
apcu \
; \
rm -r /tmp/pear; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { print $3 }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*


# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini

# SQLite Directory Setup
RUN set -eux; \
mkdir -p /var/www/data; \
chown -R www-data:www-data /var/www/data

# Version
ENV MEDIAWIKI_MAJOR_VERSION 1.41
ENV MEDIAWIKI_VERSION 1.41.0

# MediaWiki setup
RUN set -eux; \
fetchDeps=" \
gnupg \
dirmngr \
"; \
apt-get update; \
apt-get install -y --no-install-recommends $fetchDeps; \
\
curl -fSL "https://releases.wikimedia.org/mediawiki/${MEDIAWIKI_MAJOR_VERSION}/mediawiki-${MEDIAWIKI_VERSION}.tar.gz" -o mediawiki.tar.gz; \
curl -fSL "https://releases.wikimedia.org/mediawiki/${MEDIAWIKI_MAJOR_VERSION}/mediawiki-${MEDIAWIKI_VERSION}.tar.gz.sig" -o mediawiki.tar.gz.sig; \
export GNUPGHOME="$(mktemp -d)"; \
# gpg key from https://www.mediawiki.org/keys/keys.txt
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys \
D7D6767D135A514BEB86E9BA75682B08E8A3FEC4 \
441276E9CCD15F44F6D97D18C119E1A64D70938E \
F7F780D82EBFB8A56556E7EE82403E59F9F8CD79 \
1D98867E82982C8FE0ABC25F9B69B3109D3BB7B0 \
; \
gpg --batch --verify mediawiki.tar.gz.sig mediawiki.tar.gz; \
tar -x --strip-components=1 -f mediawiki.tar.gz; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" mediawiki.tar.gz.sig mediawiki.tar.gz; \
chown -R www-data:www-data extensions skins cache images; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
rm -rf /var/lib/apt/lists/*

CMD ["php-fpm"]

0 comments on commit af2e5da

Please sign in to comment.