mediawiki/Dockerfile

113 lines
3.9 KiB
Text
Raw Normal View History

2022-05-22 13:46:54 +02:00
FROM mediawiki:1.37.2
2021-01-12 08:49:20 +01:00
ENV \
WG_SITENAME="Test Wiki" \
WG_SCRIPT_PATH="" \
WG_SERVER="https://wiki.example.com" \
SEMANTIC_URL="wiki.example.com" \
WG_ENABLE_UPLOADS="0" \
WG_USE_INSTANT_COMMONS="0" \
WG_ENABLE_EMAIL="0" \
2021-01-12 08:49:20 +01:00
WG_UPLOAD_PATH="/uploads" \
WG_META_NAMESPACE="Meta" \
WG_LANGUAGE_CODE="en" \
MEDIAWIKI_ADMIN_USER="admin" \
MEDIAWIKI_ADMIN_PASS="password" \
WG_DB_TYPE="sqlite" \
WG_DB_SERVER="" \
2021-01-12 12:37:43 +01:00
WG_DB_PORT="" \
2021-01-12 08:49:20 +01:00
WG_DB_NAME="my_wiki" \
2021-01-12 12:37:43 +01:00
WG_DB_USER="mediawiki" \
2021-01-12 08:49:20 +01:00
WG_DB_PASSWORD="password" \
WG_DB_PREFIX="" \
WG_DB_MWSCHEMA="" \
WG_DATABASE_DIR="/var/www/data" \
WG_SECRET_KEY="0000000000000000000000000000000000000000000000000000000000000000" \
WG_EMERGENCY_CONTACT="admin@example.com" \
WG_PASSWORD_SENDER="wiki@example.com" \
ALLOW_PUBLIC_REGISTRATION="0" \
ALLOW_AUTO_REGISTRATION="1" \
ALLOW_PUBLIC_EDIT="0" \
ALLOW_PUBLIC_READ="1" \
USE_REMOTE_AUTH="0" \
DISABLE_ICONS="0" \
S3_ENDPOINT="https://s3.us-east-1.amazonaws.com" \
S3_INSECURE="0" \
S3_KEY="" \
S3_SECRET="" \
S3_REGION="us-east-1" \
S3_BUCKET_DOMAIN_NAME="\$1.s3.amazonaws.com" \
S3_BUCKET_NAME="" \
S3_SUBDIRECTORY="" \
DEBUG="0"
2021-01-12 08:49:20 +01:00
# System dependencies for extensions
RUN set -eu; \
apt-get update; \
apt-get install -y --no-install-recommends \
zip \
unzip \
libpq-dev \
cron \
rclone \
; \
rm -rf /var/lib/apt/lists/*
# PHP extensions
RUN set -eu; \
docker-php-ext-install -j$(nproc) pgsql; \
docker-php-ext-install -j$(nproc) pdo_pgsql
RUN set -eu; \
mkdir /var/www/conf; \
2021-01-12 09:49:30 +01:00
mkdir -p /var/www/html/extensions; \
2021-01-12 08:49:20 +01:00
mkdir -p /var/www/localstore/smwconfig; \
mkdir -p /var/www/localstore/images
# Non-composer based extensions
# JsonConfig required by Graph.
2021-01-12 09:49:30 +01:00
RUN set -eu; \
cd /var/www/html/extensions \
2022-05-22 13:46:54 +02:00
&& git clone https://github.com/edwardspec/mediawiki-aws-s3.git AWS && bash -c "(cd AWS && git checkout 301c5da5048067964a657ecce6b72e49916d03a7)" \
&& curl https://extdist.wmflabs.org/dist/extensions/JsonConfig-REL1_37-0a756af.tar.gz |tar -xz \
&& curl https://extdist.wmflabs.org/dist/extensions/Graph-REL1_37-f4cafc8.tar.gz |tar -xz \
&& curl https://extdist.wmflabs.org/dist/extensions/SubPageList3-REL1_37-5208a7b.tar.gz |tar -xz \
&& curl https://extdist.wmflabs.org/dist/extensions/MsUpload-REL1_37-246d563.tar.gz |tar -xz \
&& curl https://extdist.wmflabs.org/dist/extensions/TemplateStyles-REL1_37-929bd56.tar.gz |tar -xz \
&& curl https://extdist.wmflabs.org/dist/extensions/Auth_remoteuser-REL1_37-2852bad.tar.gz |tar -xz
2021-01-12 08:49:20 +01:00
# Install composer packages
COPY --from=library/composer:2.1 /usr/bin/composer /usr/bin/composer
2021-01-12 08:49:20 +01:00
RUN set -eu; \
ln -s /var/www/conf/LocalSettings.local.php /var/www/html/LocalSettings.local.php; \
ln -s /var/www/conf/LocalSettings.php /var/www/html/LocalSettings.php
# Make AWS (S3) dependencies installable
RUN echo '{"extra": {"merge-plugin": {"include": ["extensions/AWS/composer.json"]}}}' > composer.local.json
# Install SMB via composer
# css-sanitizer is a dependency of TemplateStyles
RUN composer require --with-all-dependencies --no-update \
wikimedia/css-sanitizer:"3.0.2" \
mediawiki/semantic-media-wiki:"~4.0.0" \
mediawiki/semantic-result-formats:"~4.0.1" \
mediawiki/maps:"~9.0.7" \
2022-05-22 13:46:54 +02:00
mediawiki/mermaid:"~3.1.0" \
mediawiki/semantic-extra-special-properties:"~3.0.1" \
mediawiki/semantic-compound-queries:"~2.2.0" \
mediawiki/page-forms:"~5.3.4" \
mediawiki/semantic-scribunto:"~2.2.0"
RUN composer update
2021-01-12 08:49:20 +01:00
# Place config files
COPY conf/* /var/www/conf/
COPY 000-default.conf /etc/apache2/sites-available
# Place our maintenence and setup scripts
COPY scripts/* /usr/local/bin/
RUN chmod 755 /usr/local/bin/*
# Add crontab file in the cron directory
ADD crontab /etc/crontab
RUN chmod 0644 /etc/crontab