mediawiki/Dockerfile

93 lines
3.3 KiB
Docker

FROM mediawiki:1.36
ARG COMPOSER_VERSION=2.1.6
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_PORT="" \
WG_DB_NAME="my_wiki" \
WG_DB_USER="mediawiki" \
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; \
mkdir -p /var/www/html/extensions; \
mkdir -p /var/www/localstore/smwconfig; \
mkdir -p /var/www/localstore/images
# Non-composer based extensions
# JsonConfig required by Graph.
RUN set -eu; \
cd /var/www/html/extensions; \
curl https://extdist.wmflabs.org/dist/extensions/JsonConfig-REL1_36-609a991.tar.gz |tar -xz; \
curl https://extdist.wmflabs.org/dist/extensions/Graph-REL1_36-67b02d1.tar.gz |tar -xz; \
curl https://extdist.wmflabs.org/dist/extensions/SubPageList3-REL1_36-f5d7175.tar.gz |tar -xz; \
curl https://extdist.wmflabs.org/dist/extensions/MsUpload-REL1_36-a6bfb91.tar.gz |tar -xz; \
curl https://extdist.wmflabs.org/dist/extensions/TemplateStyles-REL1_36-b82a604.tar.gz |tar -xz
# 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
# Enable production config
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini