mediawiki/Dockerfile

89 lines
3.1 KiB
Text
Raw Normal View History

2021-01-12 08:49:20 +01:00
FROM mediawiki:1.35
ARG COMPOSER_VERSION=2.0.8
ENV \
WG_SITENAME="Test Wiki" \
WG_SCRIPT_PATH="" \
WG_SERVER="https://wiki.example.com" \
SEMANTIC_URL="wiki.example.com" \
WG_ENABLE_UPLOADS="false" \
WG_ENABLE_EMAIL="false" \
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="" \
WG_DB_NAME="my_wiki" \
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="false" \
ALLOW_PUBLIC_EDIT="false" \
ALLOW_PUBLIC_READ="true" \
DISABLE_ICONS="false" \
DEBUG="false"
# 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; \
2021-01-12 08:49:20 +01:00
cd /var/www/html/extensions; \
2021-01-12 09:15:38 +01:00
curl https://extdist.wmflabs.org/dist/extensions/JsonConfig-REL1_35-1b79879.tar.gz |tar -xz; \
curl https://extdist.wmflabs.org/dist/extensions/Graph-REL1_35-69ec90a.tar.gz |tar -xz; \
curl https://extdist.wmflabs.org/dist/extensions/SubPageList3-REL1_35-622c298.tar.gz |tar -xz; \
curl https://extdist.wmflabs.org/dist/extensions/MsUpload-REL1_35-5998b96.tar.gz |tar -xz; \
curl https://extdist.wmflabs.org/dist/extensions/TemplateStyles-REL1_35-7a40a6a.tar.gz |tar -xz
2021-01-12 08:49:20 +01:00
# Install composer packages
RUN set -eu; \
curl -o /tmp/composer-setup.php https://getcomposer.org/installer; \
curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig; \
php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }"; \
php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION}; \
rm -rf /tmp/composer-setup.php; \
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
COPY composer.local.json /var/www/html
RUN composer update --no-dev
# 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