forked from benhutchins/docker-mediawiki
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1062da
commit af2e5da
Showing
4 changed files
with
309 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |