-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
185 lines (170 loc) · 5.95 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
FROM php:8.1-fpm
# Version
ENV MEDIAWIKI_MAJOR_VERSION=1.39
ENV MEDIAWIKI_VERSION=1.39.10
# System dependencies
RUN set -eux; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
git \
librsvg2-bin \
imagemagick \
libvips-tools \
ffmpeg \
webp \
unzip \
openssh-client \
rsync \
nano \
liblua5.1-0 \
libzip4 \
s3cmd \
python3 \
python3-pip \
; \
rm -rf /var/lib/apt/lists/*
# Install the Python packages we need
RUN set -eux; \
pip3 install Pygments --break-system-packages \
;
# Install the PHP extensions we need
RUN set -eux; \
# Install wikidiff2
# There is no pecl package for wikidiff2 (https://phabricator.wikimedia.org/T196132)
curl -sSLf \
-o /usr/local/bin/install-php-extensions \
https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions && \
chmod +x /usr/local/bin/install-php-extensions && \
install-php-extensions wikidiff2 \
; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
libicu-dev \
libonig-dev \
libcurl4-gnutls-dev \
libmagickwand-dev \
libwebp7 \
libzip-dev \
liblua5.1-0-dev \
; \
\
docker-php-ext-install -j "$(nproc)" \
calendar \
exif \
intl \
mbstring \
mysqli \
opcache \
zip \
; \
\
pecl install \
APCu \
luasandbox \
imagick \
redis \
; \
docker-php-ext-enable \
apcu \
luasandbox \
imagick \
redis \
; \
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/*
# 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; \
mkdir /var/www/mediawiki; \
tar -x --strip-components=1 -f mediawiki.tar.gz -C /var/www/mediawiki; \
gpgconf --kill all; \
rm -r "$GNUPGHOME" mediawiki.tar.gz.sig mediawiki.tar.gz; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
rm -rf /var/lib/apt/lists/*
COPY ./config/LocalSettings.php /var/www/mediawiki/LocalSettings.php
COPY ./resources /var/www/mediawiki/resources
COPY ./config/php-config.ini /usr/local/etc/php/conf.d/php-config.ini
COPY ./config/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
COPY ./config/robots.txt /var/www/mediawiki/robots.txt
RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini; \
echo 'max_execution_time = 60' >> /usr/local/etc/php/conf.d/docker-php-executiontime.ini; \
echo 'pm.max_children = 30' >> /usr/local/etc/php-fpm.d/zz-docker.conf; \
echo 'pm.max_requests = 200' >> /usr/local/etc/php-fpm.d/zz-docker.conf; \
echo 'pm.start_servers = 10' >> /usr/local/etc/php-fpm.d/zz-docker.conf; \
echo 'pm.min_spare_servers = 10' >> /usr/local/etc/php-fpm.d/zz-docker.conf; \
echo 'pm.max_spare_servers = 30' >> /usr/local/etc/php-fpm.d/zz-docker.conf;
COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY composer.local.json /var/www/mediawiki
RUN set -eux; \
chown -R www-data:www-data /var/www; \
\
mkdir /usr/local/smw; \
chown www-data:www-data /usr/local/smw
WORKDIR /var/www/mediawiki
USER www-data
RUN set -eux; \
/usr/bin/composer config --no-plugins allow-plugins.composer/installers true; \
/usr/bin/composer install --no-dev \
--ignore-platform-reqs \
--no-ansi \
--no-interaction \
--no-scripts; \
rm -f composer.lock.json ;\
/usr/bin/composer update --no-dev \
--no-ansi \
--no-interaction \
--no-scripts; \
\
mv /var/www/mediawiki/extensions/Checkuser /var/www/mediawiki/extensions/CheckUser; \
mv /var/www/mediawiki/extensions/Dismissablesitenotice /var/www/mediawiki/extensions/DismissableSiteNotice; \
mv /var/www/mediawiki/extensions/Loginnotify /var/www/mediawiki/extensions/LoginNotify; \
mv /var/www/mediawiki/extensions/Nativesvghandler /var/www/mediawiki/extensions/NativeSvgHandler; \
mv /var/www/mediawiki/extensions/Mediasearch /var/www/mediawiki/extensions/MediaSearch; \
mv /var/www/mediawiki/extensions/Revisionslider /var/www/mediawiki/extensions/RevisionSlider; \
mv /var/www/mediawiki/extensions/Rss /var/www/mediawiki/extensions/RSS; \
mv /var/www/mediawiki/extensions/Shortdescription /var/www/mediawiki/extensions/ShortDescription; \
mv /var/www/mediawiki/extensions/Vipsscaler /var/www/mediawiki/extensions/VipsScaler; \
mv /var/www/mediawiki/extensions/Webauthn /var/www/mediawiki/extensions/WebAuthn; \
mv /var/www/mediawiki/skins/citizen /var/www/mediawiki/skins/Citizen; \
mv /var/www/mediawiki/extensions/Twocolconflict /var/www/mediawiki/extensions/TwoColConflict; \
mv /var/www/mediawiki/extensions/Pageviewinfo /var/www/mediawiki/extensions/PageViewInfo; \
mv /var/www/mediawiki/extensions/Floatingui /var/www/mediawiki/extensions/FloatingUI; \
\
cp /var/www/mediawiki/extensions/PictureHtmlSupport/includes/ThumbnailImage.php /var/www/mediawiki/includes/media/ThumbnailImage.php; \
chown -R www-data:www-data /var/www
CMD ["php-fpm"]