Dockerfile.apache 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. FROM php:7.4-apache-buster
  2. # Use the default production configuration
  3. COPY contrib/docker/php.production.ini "$PHP_INI_DIR/php.ini"
  4. # Install Composer
  5. ENV COMPOSER_VERSION 1.9.2
  6. ENV COMPOSER_HOME /var/www/.composer
  7. RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
  8. && curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \
  9. && php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" \
  10. && php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php
  11. # Update OS Packages
  12. RUN apt-get update
  13. # Install OS Packages
  14. RUN apt-get install -y --no-install-recommends apt-utils
  15. RUN apt-get install -y --no-install-recommends \
  16. ## Standard
  17. locales locales-all \
  18. git \
  19. gosu \
  20. zip \
  21. unzip \
  22. libzip-dev \
  23. libcurl4-openssl-dev \
  24. ## Image Optimization
  25. optipng \
  26. pngquant \
  27. jpegoptim \
  28. gifsicle \
  29. ## Image Processing
  30. libjpeg62-turbo-dev \
  31. libpng-dev \
  32. # Required for GD
  33. libxpm4 \
  34. libxpm-dev \
  35. libwebp6 \
  36. libwebp-dev \
  37. ## Video Processing
  38. ffmpeg
  39. # Update Local data
  40. RUN sed -i '/en_US/s/^#//g' /etc/locale.gen && locale-gen && update-locale
  41. # Install PHP extensions
  42. RUN docker-php-source extract
  43. #PHP Imagemagick extensions
  44. RUN apt-get install -y --no-install-recommends libmagickwand-dev
  45. RUN pecl install imagick
  46. RUN docker-php-ext-enable imagick
  47. # PHP GD extensions
  48. RUN docker-php-ext-configure gd \
  49. --with-freetype \
  50. --with-jpeg \
  51. --with-webp \
  52. --with-xpm
  53. RUN docker-php-ext-install -j$(nproc) gd
  54. #PHP Redis extensions
  55. RUN pecl install redis
  56. RUN docker-php-ext-enable redis
  57. #PHP Database extensions
  58. RUN apt-get install -y --no-install-recommends libpq-dev libsqlite3-dev
  59. RUN docker-php-ext-install pdo_mysql pdo_pgsql pdo_sqlite
  60. #PHP extensions (dependencies)
  61. RUN docker-php-ext-configure intl
  62. RUN docker-php-ext-install -j$(nproc) intl bcmath zip pcntl exif curl
  63. #APACHE Bootstrap
  64. RUN a2enmod rewrite remoteip \
  65. && {\
  66. echo RemoteIPHeader X-Real-IP ;\
  67. echo RemoteIPTrustedProxy 10.0.0.0/8 ;\
  68. echo RemoteIPTrustedProxy 172.16.0.0/12 ;\
  69. echo RemoteIPTrustedProxy 192.168.0.0/16 ;\
  70. echo SetEnvIf X-Forwarded-Proto "https" HTTPS=on ;\
  71. } > /etc/apache2/conf-available/remoteip.conf \
  72. && a2enconf remoteip
  73. #Cleanup
  74. RUN docker-php-source delete
  75. RUN apt-get autoremove --purge -y
  76. RUN apt-get clean
  77. RUN rm -rf /var/cache/apt
  78. RUN rm -rf /var/lib/apt/lists/*
  79. ENV PATH="~/.composer/vendor/bin:./vendor/bin:${PATH}"
  80. COPY . /var/www/
  81. WORKDIR /var/www/
  82. RUN cp -r storage storage.skel
  83. RUN composer global require hirak/prestissimo --no-interaction --no-suggest --prefer-dist
  84. RUN composer install --prefer-dist --no-interaction --no-ansi --optimize-autoloader
  85. RUN composer global remove hirak/prestissimo
  86. RUN rm -rf html && ln -s public html
  87. VOLUME /var/www/storage /var/www/bootstrap
  88. CMD ["/var/www/contrib/docker/start.apache.sh"]