-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
117 lines (89 loc) · 3.49 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
FROM toniher/nginx-php:nginx-1.23-php-7.4
ARG MEDIAWIKI_VERSION=1.35
ARG MEDIAWIKI_FULL_VERSION=1.35.9
ARG DB_CONTAINER=db
ARG PARSOID_CONTAINER=parsoid
ARG MYSQL_HOST=127.0.0.1
ARG MYSQL_DATABASE=mediawiki
ARG MYSQL_USER=mediawiki
ARG MYSQL_PASSWORD=mediawiki
ARG MYSQL_PREFIX=mw_
ARG MW_PASSWORD=prova
ARG MW_SCRIPTPATH=/w
ARG MW_WIKILANG=en
ARG MW_WIKINAME=Test
ARG MW_WIKIUSER=WikiSysop
ARG MW_EMAIL=hello@localhost
ARG DOMAIN_NAME=localhost
ARG PROTOCOL=http://
ARG MW_NEW=true
# Forcing Invalidate cache
ARG CACHE_INSTALL=2022-12-29
RUN set -x; \
apt-get update && apt-get -y upgrade;
RUN set -x; \
apt-get install -y gnupg jq php7.4-redis;
RUN set -x; \
rm -rf /var/lib/apt/lists/*
# Starting processes
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Copy helpers
COPY download-extension.sh /usr/local/bin/
COPY download-extension-git.sh /usr/local/bin/
COPY nginx-default.conf /etc/nginx/conf.d/default.conf
# Adding extra domain name
RUN sed -i "s/localhost/localhost $DOMAIN_NAME/" /etc/nginx/conf.d/default.conf
RUN mkdir -p /var/www/w; chown www-data:www-data /var/www/w
USER www-data
WORKDIR /tmp
ENV GNUPGHOME /tmp
# https://www.mediawiki.org/keys/keys.txt
RUN gpg --no-tty --fetch-keys "https://www.mediawiki.org/keys/keys.txt"
RUN MEDIAWIKI_DOWNLOAD_URL="https://releases.wikimedia.org/mediawiki/$MEDIAWIKI_VERSION/mediawiki-$MEDIAWIKI_FULL_VERSION.tar.gz"; \
set -x; \
curl -fSL "$MEDIAWIKI_DOWNLOAD_URL" -o mediawiki.tar.gz \
&& curl -fSL "${MEDIAWIKI_DOWNLOAD_URL}.sig" -o mediawiki.tar.gz.sig \
&& gpg --verify mediawiki.tar.gz.sig \
&& tar -xf mediawiki.tar.gz -C /var/www/w --strip-components=1 \
&& rm -f mediawiki*
COPY composer.local.json /var/www/w
RUN set -x; echo "Host is $MYSQL_HOST"
RUN if [ "$MW_NEW" = "true" ] ; then cd /var/www/w; php maintenance/install.php \
--dbname "$MYSQL_DATABASE" \
--dbpass "$MYSQL_PASSWORD" \
--dbserver "$MYSQL_HOST" \
--dbtype mysql \
--dbprefix "$MYSQL_PREFIX" \
--dbuser "$MYSQL_USER" \
--installdbpass "$MYSQL_PASSWORD" \
--installdbuser "$MYSQL_USER" \
--pass "$MW_PASSWORD" \
--scriptpath "$MW_SCRIPTPATH" \
--lang "$MW_WIKILANG" \
"${MW_WIKINAME}" "${MW_WIKIUSER}" ; fi
# VisualEditor extension
RUN ENVEXT=$MEDIAWIKI_VERSION && ENVEXT=$(echo $ENVEXT | sed -r "s/\./_/g") && bash /usr/local/bin/download-extension.sh VisualEditor $ENVEXT /var/www/w/extensions
# Addding extra stuff to LocalSettings. Only if new installation
RUN if [ "$MW_NEW" = "true" ] ; then echo "\n\
enableSemantics( '${DOMAIN_NAME}' );\n\
require_once __DIR__ . '/extensions/SemanticBundle/SemanticBundle.php';\n" >> /var/www/w/LocalSettings.php ; fi
RUN cd /var/www/w; composer update --no-dev;
RUN cd /var/www/w; php maintenance/update.php
# Update Semantic MediaWiki
RUN cd /var/www/w; php extensions/SemanticMediaWiki/maintenance/rebuildData.php -fpv
RUN cd /var/www/w; php extensions/SemanticMediaWiki/maintenance/rebuildData.php -v
RUN cd /var/www/w; php maintenance/runJobs.php
RUN sed -i "s/$MYSQL_HOST/$DB_CONTAINER/" /var/www/w/LocalSettings.php
# File LocalSettings.local.php
RUN if [ "$MW_NEW" = "true" ] ; then echo "\n\
include_once \"\$IP/LocalSettings.local.php\"; " >> /var/www/w/LocalSettings.php ; fi
# Redis configuration
# Adding redis config. Only if new installation
RUN if [ "$MW_NEW" = "true" ] ; then echo "\n\
include_once \"\$IP/LocalSettings.redis.php\"; " >> /var/www/w/LocalSettings.php ; fi
# VOLUME image
VOLUME /var/www/w/images
WORKDIR /var/www/w
USER root
RUN mkdir -p /run/php
CMD ["/usr/bin/supervisord"]