-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
142 lines (125 loc) · 8.23 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
FROM php:7.4-apache
ENV WIKI_VERSION_MAJOR_MINOR=1.39
ENV WIKI_VERSION_BUGFIX=10
ENV WIKI_VERSION=$WIKI_VERSION_MAJOR_MINOR.$WIKI_VERSION_BUGFIX
ENV WIKI_VERSION_STR=1_39
RUN apt-get update && apt-get install -y --no-install-recommends \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libmagickwand-dev \
libicu-dev \
libldap2-dev \
libldap-2.4-2 \
libldap-common \
netcat \
git \
imagemagick \
unzip \
vim \
libonig-dev \
# for simpleSAMLphp
libzip-dev \
# for TimedMediaHandler
ffmpeg \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/cache/apt/archives/* \
&& ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so \
&& ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so \
&& docker-php-source extract
# install php extensions
# pcntl for Scribunto, zip for SimpleSAMLphp
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions mbstring xml intl mysqli ldap pcntl opcache calendar zip imagick redis memcached
RUN a2enmod rewrite
WORKDIR /var/www/html
RUN curl -L https://releases.wikimedia.org/mediawiki/$WIKI_VERSION_MAJOR_MINOR/mediawiki-$WIKI_VERSION.tar.gz | tar xz --strip=1
COPY php.ini /usr/local/etc/php/
COPY mediawiki.conf /etc/apache2/
RUN echo "Include /etc/apache2/mediawiki.conf" >> /etc/apache2/apache2.conf \
&& rm /etc/apache2/sites-enabled/000-default.conf \
&& a2enmod proxy \
&& a2enmod proxy_http \
&& a2enmod remoteip
COPY docker-entrypoint.sh /entrypoint.sh
COPY docker-startuptasks.sh /startuptasks.sh
COPY LocalSettings.php /var/www/html/LocalSettings.php
COPY CustomHooks.php /var/www/html/CustomHooks.php
COPY composer.local.json /var/www/html/composer.local.json
COPY robots.txt /var/www/html/robots.txt
# composer won't load plugins if we don't explicitly allow executing as root
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN curl -L https://getcomposer.org/installer | php \
&& php composer.phar install --no-dev
RUN EXTS=`curl https://extdist.wmflabs.org/dist/extensions/ | awk 'BEGIN { FS = "\"" } ; {print $2}'` \
&& for i in SmiteSpam VisualEditor Scribunto LiquidThreads Cite WikiEditor LDAPProvider PluggableAuth LDAPAuthentication2 ParserFunctions TemplateData InputBox Widgets Variables RightFunctions PageInCat CategoryTree LabeledSectionTransclusion UserPageEditProtection Quiz Collection DeleteBatch LinkTarget HitCounters Math 3D MultimediaViewer TimedMediaHandler SimpleSAMLphp; do \
FILENAME=`echo "$EXTS" | grep ^${i}-REL${WIKI_VERSION_STR}`; \
echo "Installing https://extdist.wmflabs.org/dist/extensions/$FILENAME"; \
curl -Ls https://extdist.wmflabs.org/dist/extensions/$FILENAME | tar xz -C /var/www/html/extensions; \
done \
&& echo "Installing https://github.com/ubc/EmbedPage/archive/v2.0.2.tar.gz" \
&& mkdir /var/www/html/extensions/EmbedPage \
&& curl -Ls https://github.com/ubc/EmbedPage/archive/v2.0.1.tar.gz | tar xz --strip=1 -C /var/www/html/extensions/EmbedPage \
&& echo "Installing https://github.com/ubc/mediawiki-extensions-UploadWizard/archive/mw1.39.tar.gz" \
&& mkdir /var/www/html/extensions/UploadWizard \
&& curl -Ls https://github.com/ubc/mediawiki-extensions-UploadWizard/archive/mw1.39.tar.gz | tar xz --strip=1 -C /var/www/html/extensions/UploadWizard \
&& echo "Installing https://github.com/ubc/mediawiki-extensions-UWUBCMessages/archive/master.tar.gz" \
&& mkdir /var/www/html/extensions/UWUBCMessages \
&& curl -Ls https://github.com/ubc/mediawiki-extensions-UWUBCMessages/archive/master.tar.gz | tar xz --strip=1 -C /var/www/html/extensions/UWUBCMessages \
&& echo "Installing https://github.com/smarty-php/smarty/archive/v3.1.44.tar.gz" \
&& mkdir -p /var/www/html/extensions/Widgets/smarty \
&& curl -Ls https://github.com/smarty-php/smarty/archive/v3.1.44.tar.gz | tar xz --strip=1 -C /var/www/html/extensions/Widgets/smarty \
&& echo "Installing https://github.com/SkizNet/mediawiki-GTag/archive/master.tar.gz" \
&& mkdir -p /var/www/html/extensions/GTag \
&& curl -Ls https://github.com/SkizNet/mediawiki-GTag/archive/master.tar.gz | tar xz --strip=1 -C /var/www/html/extensions/GTag\
&& echo "Installing https://github.com/ubc/mediawiki-extensions-caliper/archive/v2.0.5.tar.gz" \
&& mkdir -p /var/www/html/extensions/caliper \
&& curl -Ls https://github.com/ubc/mediawiki-extensions-caliper/archive/v2.0.5.tar.gz | tar xz --strip=1 -C /var/www/html/extensions/caliper \
&& echo "Installing https://github.com/ubc/mediawiki-extensions-ubcauth/archive/master.tar.gz" \
&& mkdir -p /var/www/html/extensions/UBCAuth\
&& curl -Ls https://github.com/ubc/mediawiki-extensions-ubcauth/archive/master.tar.gz | tar xz --strip=1 -C /var/www/html/extensions/UBCAuth \
&& echo "Installing https://github.com/ubc/mediawiki-extensions-AutoCreatedUserRedirector/archive/master.tar.gz" \
&& mkdir -p /var/www/html/extensions/AutoCreatedUserRedirector \
&& curl -Ls https://github.com/ubc/mediawiki-extensions-AutoCreatedUserRedirector/archive/master.tar.gz | tar xz --strip=1 -C /var/www/html/extensions/AutoCreatedUserRedirector \
# WARNING: if updating DynamicPageList3 from 3.5.1, check if fix below is still required \
&& echo "Installing https://github.com/Universal-Omega/DynamicPageList3/archive/refs/tags/3.5.1.tar.gz" \
&& mkdir -p /var/www/html/extensions/DynamicPageList \
&& curl -Ls https://github.com/Universal-Omega/DynamicPageList3/archive/refs/tags/3.5.1.tar.gz | tar xz --strip=1 -C /var/www/html/extensions/DynamicPageList
##Comment out to use with MW Extension method
##&& echo "Installing SmiteSpam https://github.com/wikimedia/mediawiki-extensions-SmiteSpam/archive/REL1_39.zip" \
##&& curl -L -o smitespam.zip https://github.com/wikimedia/mediawiki-extensions-SmiteSpam/archive/REL1_39.zip \
##&& unzip smitespam.zip -d /var/www/html/extensions/ \
##&& mv /var/www/html/extensions/mediawiki-extensions-SmiteSpam-REL1_39 /var/www/html/extensions/SmiteSpam
#&& echo "Installing patched Math extension from https://github.com/ubc/mediawiki-extensions-Math/archive/REL1_35.tar.gz" \
#&& mkdir -p /var/www/html/extensions/Math \
#&& curl -Ls https://github.com/ubc/mediawiki-extensions-Math/archive/REL1_35.tar.gz | tar xz --strip=1 -C /var/www/html/extensions/Math
# WARNING: Below fix is only for DynamicPageList3 3.5.1
# Patch to fix Math Exam Resources DPL
COPY ./extensions/DynamicPageList/includes/Query.php /var/www/html/extensions/DynamicPageList/includes/Query.php
# TODO: Remove if >REL1_40, as this is a backport from Vector REL1_40
# Add login button next to "..." menu in top-right corner
COPY skins/Vector/includes/Hooks.php /var/www/html/skins/Vector/includes/Hooks.php
COPY skins/Vector/includes/SkinVector.php /var/www/html/skins/Vector/includes/SkinVector.php
# TODO: Also remove on upgrade, this is a Vector customization to make the main
# menu behave more like current Wikipedia (dropdown over the page)
COPY skins/Vector/resources/skins.vector.styles/components/Sidebar.less \
/var/www/html/skins/Vector/resources/skins.vector.styles/components/Sidebar.less
COPY skins/Vector/resources/skins.vector.styles/components/TableOfContents.less \
/var/www/html/skins/Vector/resources/skins.vector.styles/components/TableOfContents.less
COPY skins/Vector/resources/skins.vector.styles/layouts/screen.less \
/var/www/html/skins/Vector/resources/skins.vector.styles/layouts/screen.less
COPY skins/Vector/includes/templates/Sidebar.mustache \
/var/www/html/skins/Vector/includes/templates/Sidebar.mustache
COPY skins/Vector/includes/templates/skin.mustache \
/var/www/html/skins/Vector/includes/templates/skin.mustache
COPY skins/Vector/resources/skins.vector.styles/components/MenuTabs.less \
/var/www/html/skins/Vector/resources/skins.vector.styles/components/MenuTabs.less
# composer.local.json merges in composer.json from caliper extension, so we
# need to run composer update after getting the extensions.
RUN php composer.phar update --no-dev
RUN mkdir -p /data \
&& chmod a+rw /var/www/html/extensions/Widgets/compiled_templates
VOLUME /data
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]
CMD ["apachectl", "-e", "info", "-D", "FOREGROUND"]