-
Notifications
You must be signed in to change notification settings - Fork 41
/
Dockerfile
117 lines (97 loc) · 5.33 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 php:7.0-fpm
MAINTAINER Kristoph Junge <kristoph.junge@gmail.com>
# Change UID and GID of www-data user to match host privileges
RUN usermod -u 999 www-data && \
groupmod -g 999 www-data
# Utilities
RUN apt-get update && \
apt-get -y install apt-transport-https ca-certificates git curl --no-install-recommends && \
rm -r /var/lib/apt/lists/*
# MySQL PHP extension
RUN docker-php-ext-install mysqli
# Pear mail
RUN curl -s -o /tmp/go-pear.phar http://pear.php.net/go-pear.phar && \
echo '/usr/bin/php /tmp/go-pear.phar "$@"' > /usr/bin/pear && \
chmod +x /usr/bin/pear && \
pear install mail Net_SMTP
# Imagick with PHP extension
RUN apt-get update && apt-get install -y imagemagick libmagickwand-6.q16-dev --no-install-recommends && \
ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/MagickWand-config /usr/bin/ && \
pecl install imagick-3.4.0RC6 && \
echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini && \
rm -rf /var/lib/apt/lists/*
# Intl PHP extension
RUN apt-get update && apt-get install -y libicu-dev g++ --no-install-recommends && \
docker-php-ext-install intl && \
apt-get install -y --auto-remove libicu52 g++ && \
rm -rf /var/lib/apt/lists/*
# APC PHP extension
RUN pecl install apcu && \
pecl install apcu_bc-1.0.3 && \
docker-php-ext-enable apcu --ini-name 10-docker-php-ext-apcu.ini && \
docker-php-ext-enable apc --ini-name 20-docker-php-ext-apc.ini
# Nginx
RUN apt-get update && \
apt-get -y install nginx && \
rm -r /var/lib/apt/lists/*
COPY config/nginx/* /etc/nginx/
# PHP-FPM
COPY config/php-fpm/php-fpm.conf /usr/local/etc/
COPY config/php-fpm/php.ini /usr/local/etc/php/
RUN mkdir -p /var/run/php7-fpm/ && \
chown www-data:www-data /var/run/php7-fpm/
# Supervisor
RUN apt-get update && \
apt-get install -y supervisor --no-install-recommends && \
rm -r /var/lib/apt/lists/*
COPY config/supervisor/supervisord.conf /etc/supervisor/conf.d/
COPY config/supervisor/kill_supervisor.py /usr/bin/
# NodeJS
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - && \
apt-get install -y nodejs --no-install-recommends
# Parsoid
RUN useradd parsoid --no-create-home --home-dir /usr/lib/parsoid --shell /usr/sbin/nologin
RUN apt-key advanced --keyserver pgp.mit.edu --recv-keys 90E9F83F22250DD7 && \
echo "deb https://releases.wikimedia.org/debian jessie-mediawiki main" > /etc/apt/sources.list.d/parsoid.list && \
apt-get update && \
apt-get -y install parsoid --no-install-recommends
COPY config/parsoid/config.yaml /usr/lib/parsoid/src/config.yaml
ENV NODE_PATH /usr/lib/parsoid/node_modules:/usr/lib/parsoid/src
# MediaWiki
ARG MEDIAWIKI_VERSION_MAJOR=1
ARG MEDIAWIKI_VERSION_MINOR=30
ARG MEDIAWIKI_VERSION_BUGFIX=0
RUN curl -s -o /tmp/keys.txt https://www.mediawiki.org/keys/keys.txt && \
curl -s -o /tmp/mediawiki.tar.gz https://releases.wikimedia.org/mediawiki/$MEDIAWIKI_VERSION_MAJOR.$MEDIAWIKI_VERSION_MINOR/mediawiki-$MEDIAWIKI_VERSION_MAJOR.$MEDIAWIKI_VERSION_MINOR.$MEDIAWIKI_VERSION_BUGFIX.tar.gz && \
curl -s -o /tmp/mediawiki.tar.gz.sig https://releases.wikimedia.org/mediawiki/$MEDIAWIKI_VERSION_MAJOR.$MEDIAWIKI_VERSION_MINOR/mediawiki-$MEDIAWIKI_VERSION_MAJOR.$MEDIAWIKI_VERSION_MINOR.$MEDIAWIKI_VERSION_BUGFIX.tar.gz.sig && \
gpg --import /tmp/keys.txt && \
gpg --list-keys --fingerprint --with-colons | sed -E -n -e 's/^fpr:::::::::([0-9A-F]+):$/\1:6:/p' | gpg --import-ownertrust && \
gpg --verify /tmp/mediawiki.tar.gz.sig /tmp/mediawiki.tar.gz && \
mkdir -p /var/www/mediawiki /data /images && \
tar -xzf /tmp/mediawiki.tar.gz -C /tmp && \
mv /tmp/mediawiki-$MEDIAWIKI_VERSION_MAJOR.$MEDIAWIKI_VERSION_MINOR.$MEDIAWIKI_VERSION_BUGFIX/* /var/www/mediawiki && \
rm -rf /tmp/mediawiki.tar.gz /tmp/mediawiki-$MEDIAWIKI_VERSION_MAJOR.$MEDIAWIKI_VERSION_MINOR.$MEDIAWIKI_VERSION_BUGFIX/ /tmp/keys.txt && \
rm -rf /var/www/mediawiki/images && \
ln -s /images /var/www/mediawiki/images && \
chown -R www-data:www-data /data /images /var/www/mediawiki/images
COPY config/mediawiki/* /var/www/mediawiki/
# VisualEditor extension
RUN curl -s -o /tmp/extension-visualeditor.tar.gz https://extdist.wmflabs.org/dist/extensions/VisualEditor-REL${MEDIAWIKI_VERSION_MAJOR}_${MEDIAWIKI_VERSION_MINOR}-`curl -s https://extdist.wmflabs.org/dist/extensions/ | grep -o -P "(?<=VisualEditor-REL${MEDIAWIKI_VERSION_MAJOR}_${MEDIAWIKI_VERSION_MINOR}-)[0-9a-z]{7}(?=.tar.gz)" | head -1`.tar.gz && \
tar -xzf /tmp/extension-visualeditor.tar.gz -C /var/www/mediawiki/extensions && \
rm /tmp/extension-visualeditor.tar.gz
# User merge and delete extension
RUN curl -s -o /tmp/extension-usermerge.tar.gz https://extdist.wmflabs.org/dist/extensions/UserMerge-REL${MEDIAWIKI_VERSION_MAJOR}_${MEDIAWIKI_VERSION_MINOR}-`curl -s https://extdist.wmflabs.org/dist/extensions/ | grep -o -P "(?<=UserMerge-REL${MEDIAWIKI_VERSION_MAJOR}_${MEDIAWIKI_VERSION_MINOR}-)[0-9a-z]{7}(?=.tar.gz)" | head -1`.tar.gz && \
tar -xzf /tmp/extension-usermerge.tar.gz -C /var/www/mediawiki/extensions && \
rm /tmp/extension-usermerge.tar.gz
# Set work dir
WORKDIR /var/www/mediawiki
# Copy docker entry point script
COPY docker-entrypoint.sh /docker-entrypoint.sh
# Copy install and update script
RUN mkdir /script
COPY script/* /script/
# General setup
VOLUME ["/var/cache/nginx", "/data", "/images"]
EXPOSE 8080
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD []