-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
136 lines (108 loc) · 4.42 KB
/
Dockerfile
File metadata and controls
136 lines (108 loc) · 4.42 KB
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
######################
# Global settings #
######################
ARG MEDIAWIKI_VERSION=stable-fpm
################
# Fetcher #
################
FROM ubuntu:jammy AS fetcher
RUN apt-get update && \
apt-get install --yes --no-install-recommends git=1:2.* ssh unzip=6.* jq=1.* curl=7.* ca-certificates patch && \
apt-get install --reinstall ca-certificates && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# make global settings known in this build stage
WORKDIR /
# clone extensions from github, using specific branch
COPY wikibase-submodules-from-github-instead-of-phabricator.patch clone_all.sh ./
RUN bash clone_all.sh
################
# Composer #
################
FROM mediawiki:${MEDIAWIKI_VERSION} AS build
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get install --yes --no-install-recommends \
zlib1g-dev libjpeg-dev libpng-dev libfreetype6-dev libzip-dev zip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN set -xe \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd \
&& docker-php-ext-enable gd \
&& docker-php-ext-install zip
RUN rm -rf /var/www/html/*
COPY --from=fetcher /mediawiki /var/www/html
WORKDIR /var/www/html/
COPY composer.local.json /var/www/html/composer.local.json
COPY --from=composer /usr/bin/composer /usr/bin/composer
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN git config --global --add safe.directory /var/www/html
RUN composer install --no-dev
#######################################
# MaRDI wikibase #
# Build from official mediawiki image #
#######################################
FROM mediawiki:${MEDIAWIKI_VERSION}
WORKDIR /var/www/html/w/
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive\
apt-get install --yes --no-install-recommends \
nano jq=1.* libbz2-dev=1.* gettext-base cron vim librsvg2-bin libpq-dev libyaml-dev \
lua5.1 liblua5.1-0-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN install -d /var/log/mediawiki -o www-data
RUN pecl install yaml && docker-php-ext-enable yaml
RUN docker-php-ext-install calendar bz2 pdo pgsql pdo_pgsql
RUN rm -rf /var/www/html/*
COPY --from=build /var/www/html /var/www/html/w
# Temporarily patch EventBus
RUN php -r " \
\$f = '/var/www/html/w/extensions/EventBus/includes/Rest/EventBodyValidator.php'; \
\$code = file_get_contents(\$f); \
\$code = str_replace( \
\"unset( \\\$event['mediawiki_signature'] );\", \
\"unset( \\\$event['mediawiki_signature'] );\\n\\t\\tunset( \\\$event['meta']['dt'] );\", \
\$code \
); \
file_put_contents(\$f, \$code); \
"
COPY wait-for-it.sh /wait-for-it.sh
RUN chmod +x /wait-for-it.sh
COPY entrypoint.sh /entrypoint.sh
COPY LocalSettings.php.template /LocalSettings.php.template
COPY robots.txt /var/www/html/w/robots.txt
COPY images /var/www/html/w/images_repo/
ENV MW_SITE_NAME=wikibase-docker\
MW_SITE_LANG=en
ARG ENVIRONMENT=staging
COPY ./LocalSettings.d/base /var/www/html/w/LocalSettings.d
COPY ./LocalSettings.d/${ENVIRONMENT} /var/www/html/w/LocalSettings.d
COPY extra-install.sh /
COPY oauth.ini /templates/oauth.ini
RUN mkdir /shared
# Setup regular maintenance cron in MediaWiki container.
COPY regular_maintenance.sh /var/www/html/regular_maintenance.sh
RUN chmod ugo+rwx /var/www/html/regular_maintenance.sh
RUN echo "* */1 * * * root /var/www/html/regular_maintenance.sh > /var/www/html/regular_maintenance.log" \
>> /etc/cron.d/Regular_maintenance
# Set ownership of the uploaded images directory
RUN chown www-data:www-data /var/www/html/w/images
# Fix permissions for cache https://github.com/MaRDI4NFDI/portal-compose/pull/563
RUN chmod 777 /var/www/html/w/cache
COPY mardi_php.ini /usr/local/etc/php/conf.d/mardi_php.ini
# PHP-FPM configuration
COPY ./php-fpm/logging.conf /usr/local/etc/php-fpm.d/zz-logging.conf
# PHP-FPM tuning via environment variables (production defaults)
ENV PHP_FPM_PM=dynamic \
PHP_FPM_MAX_CHILDREN=75 \
PHP_FPM_START_SERVERS=25 \
PHP_FPM_MIN_SPARE_SERVERS=10 \
PHP_FPM_MAX_SPARE_SERVERS=40 \
PHP_FPM_MAX_REQUESTS=1000 \
PHP_FPM_REQUEST_TIMEOUT=60s
COPY ./php-fpm/performance.conf.template /templates/performance.conf.template
ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN printf '[PHP]\ndate.timezone = "Europe/Berlin"\n' > /usr/local/etc/php/conf.d/tzone.ini
ENTRYPOINT ["/bin/bash"]
CMD ["/entrypoint.sh"]