dockerfile 3.4 KB

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