dockerfile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. FROM php:7.0-apache
  2. # System dependencies
  3. RUN set -eux; \
  4. \
  5. apt-get update; \
  6. apt-get install -y --no-install-recommends \
  7. git \
  8. librsvg2-bin \
  9. imagemagick \
  10. # Required for SyntaxHighlighting
  11. python3 \
  12. ; \
  13. rm -rf /var/lib/apt/lists/*
  14. # Install the PHP extensions we need
  15. RUN set -eux; \
  16. \
  17. savedAptMark="$(apt-mark showmanual)"; \
  18. \
  19. apt-get update; \
  20. apt-get install -y --no-install-recommends \
  21. libicu-dev \
  22. ; \
  23. \
  24. docker-php-ext-install -j "$(nproc)" \
  25. intl \
  26. mbstring \
  27. mysqli \
  28. opcache \
  29. ; \
  30. \
  31. pecl install APCu-5.1.19; \
  32. docker-php-ext-enable \
  33. apcu \
  34. ; \
  35. \
  36. # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
  37. apt-mark auto '.*' > /dev/null; \
  38. apt-mark manual $savedAptMark; \
  39. ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
  40. | awk '/=>/ { print $3 }' \
  41. | sort -u \
  42. | xargs -r dpkg-query -S \
  43. | cut -d: -f1 \
  44. | sort -u \
  45. | xargs -rt apt-mark manual; \
  46. \
  47. apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
  48. rm -rf /var/lib/apt/lists/*
  49. # Enable Short URLs
  50. RUN set -eux; \
  51. a2enmod rewrite; \
  52. { \
  53. echo "<Directory /var/www/html>"; \
  54. echo " RewriteEngine On"; \
  55. echo " RewriteCond %{REQUEST_FILENAME} !-f"; \
  56. echo " RewriteCond %{REQUEST_FILENAME} !-d"; \
  57. echo " RewriteRule ^ %{DOCUMENT_ROOT}/index.php [L]"; \
  58. echo "</Directory>"; \
  59. } > "$APACHE_CONFDIR/conf-available/short-url.conf"; \
  60. a2enconf short-url
  61. # Enable AllowEncodedSlashes for VisualEditor
  62. RUN sed -i "s/<\/VirtualHost>/\tAllowEncodedSlashes NoDecode\n<\/VirtualHost>/" "$APACHE_CONFDIR/sites-available/000-default.conf"
  63. # set recommended PHP.ini settings
  64. # see https://secure.php.net/manual/en/opcache.installation.php
  65. RUN { \
  66. echo 'opcache.memory_consumption=128'; \
  67. echo 'opcache.interned_strings_buffer=8'; \
  68. echo 'opcache.max_accelerated_files=4000'; \
  69. echo 'opcache.revalidate_freq=60'; \
  70. } > /usr/local/etc/php/conf.d/opcache-recommended.ini
  71. # SQLite Directory Setup
  72. RUN set -eux; \
  73. mkdir -p /var/www/data; \
  74. chown -R www-data:www-data /var/www/data
  75. # Version
  76. ENV MEDIAWIKI_MAJOR_VERSION 1.27
  77. ENV MEDIAWIKI_VERSION 1.27.0
  78. # MediaWiki setup
  79. RUN set -eux; \
  80. fetchDeps=" \
  81. gnupg \
  82. dirmngr \
  83. python3 \
  84. "; \
  85. apt-get update; \
  86. apt-get install -y --no-install-recommends $fetchDeps; \
  87. \
  88. curl -fSL "https://releases.wikimedia.org/mediawiki/${MEDIAWIKI_MAJOR_VERSION}/mediawiki-${MEDIAWIKI_VERSION}.tar.gz" -o mediawiki.tar.gz; \
  89. curl -fSL "https://releases.wikimedia.org/mediawiki/${MEDIAWIKI_MAJOR_VERSION}/mediawiki-${MEDIAWIKI_VERSION}.tar.gz.sig" -o mediawiki.tar.gz.sig; \
  90. export GNUPGHOME="$(mktemp -d)"; \
  91. # gpg key from https://www.mediawiki.org/keys/keys.txt
  92. # gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys \
  93. # D7D6767D135A514BEB86E9BA75682B08E8A3FEC4 \
  94. # 441276E9CCD15F44F6D97D18C119E1A64D70938E \
  95. # F7F780D82EBFB8A56556E7EE82403E59F9F8CD79 \
  96. # 1D98867E82982C8FE0ABC25F9B69B3109D3BB7B0 \
  97. # ; \
  98. # gpg --batch --verify mediawiki.tar.gz.sig mediawiki.tar.gz; \
  99. tar -x --strip-components=1 -f mediawiki.tar.gz; \
  100. gpgconf --kill all; \
  101. rm -r "$GNUPGHOME" mediawiki.tar.gz.sig mediawiki.tar.gz; \
  102. chown -R www-data:www-data extensions skins cache images; \
  103. \
  104. apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
  105. rm -rf /var/lib/apt/lists/*
  106. VOLUME /var/www/
  107. CMD ["apache2-foreground"]