You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
5.0 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. RUN apt-get update && apt-get install -y \
  2. libfreetype6-dev \
  3. libjpeg62-turbo-dev \
  4. libpng-dev \
  5. libwebp-dev \
  6. && docker-php-ext-install -j$(nproc) iconv \
  7. && docker-php-ext-install mysqli \
  8. && docker-php-ext-enable mysqli
  9. RUN apt-get update && docker-php-ext-install pdo pdo_mysql \
  10. && docker-php-ext-enable pdo pdo_mysql
  11. ###########################################################################
  12. # xDebug:
  13. ###########################################################################
  14. # Copy xdebug configuration for remote debugging
  15. COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
  16. ARG INSTALL_XDEBUG=false
  17. RUN if [ ${INSTALL_XDEBUG} = true ]; then \
  18. # Install the xdebug extension
  19. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  20. pecl install xdebug-2.5.5; \
  21. else \
  22. pecl install xdebug-2.9.8; \
  23. fi && \
  24. docker-php-ext-enable xdebug && \
  25. sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
  26. ;fi
  27. ###########################################################################
  28. # Redis and igbinary:
  29. ###########################################################################
  30. ARG INSTALL_REDIS=false
  31. COPY ./igbinary.ini /usr/local/etc/php/conf.d/igbinary.ini
  32. RUN if [ ${INSTALL_REDIS} = true ]; then \
  33. pecl install -a igbinary \
  34. && docker-php-ext-enable igbinary \
  35. && printf "yes\n" | pecl install redis \
  36. && docker-php-ext-enable redis \
  37. ;fi
  38. ###########################################################################
  39. # Zip:
  40. ###########################################################################
  41. ARG INSTALL_ZIP=false
  42. RUN if [ ${INSTALL_ZIP} = true ]; then \
  43. apt update && apt install -y libzip-dev \
  44. && docker-php-ext-install zip \
  45. && docker-php-ext-enable zip \
  46. ;fi
  47. ###########################################################################
  48. # BZ2:
  49. ###########################################################################
  50. ARG INSTALL_BZ2=false
  51. RUN if [ ${INSTALL_BZ2} = true ]; then \
  52. apt update && apt install -y libbz2-ocaml-dev \
  53. && docker-php-ext-install bz2 \
  54. && docker-php-ext-enable bz2 \
  55. ;fi
  56. ###########################################################################
  57. # INTL:
  58. ###########################################################################
  59. ARG INSTALL_INTL=false
  60. RUN if [ ${INSTALL_INTL} = true ]; then \
  61. apt update && apt install -y libicu-dev \
  62. && docker-php-ext-install intl \
  63. && docker-php-ext-enable intl \
  64. ;fi
  65. ###########################################################################
  66. # PGSQL:
  67. ###########################################################################
  68. ARG INSTALL_PGSQL=false
  69. RUN if [ ${INSTALL_PGSQL} = true ]; then \
  70. apt update && apt install -y libpq-dev \
  71. && docker-php-ext-install pgsql \
  72. && docker-php-ext-install pdo_pgsql \
  73. ;fi
  74. ###########################################################################
  75. # BCMATH:
  76. ###########################################################################
  77. ARG INSTALL_BCMATH=false
  78. RUN if [ ${INSTALL_BCMATH} = true ]; then \
  79. docker-php-ext-install bcmath \
  80. ;fi
  81. ###########################################################################
  82. # Pear Mail and Mail_Mime:
  83. ###########################################################################
  84. ARG INSTALL_PEAR_MAIL=false
  85. RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
  86. pear install Mail && pear install Mail_Mime \
  87. ;fi
  88. ###########################################################################
  89. # php.ini opts:
  90. ###########################################################################
  91. # https://github.com/php/php-src/blob/master/php.ini-development
  92. RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
  93. ARG PHP_OPT_SHORT_OPEN_TAG=Off
  94. RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" "$PHP_INI_DIR/php.ini"
  95. ARG PHP_OPT_MAX_EXECUTION_TIME=30
  96. RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTION_TIME/g" "$PHP_INI_DIR/php.ini"
  97. ARG PHP_OPT_MEMORY_LIMIT=128M
  98. RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini"
  99. ARG PHP_OPT_UPLOAD_MAX_FILESIZE=2M
  100. RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
  101. ###########################################################################
  102. # Prepend nginx 502 on showing errors:
  103. # @see https://stackoverflow.com/questions/55260221/laravel-php-7-3-nginx-502-upstream-prematurely-closed-fastcgi-stdout
  104. ###########################################################################
  105. RUN sed -i "s/^log_limit = .*/log_limit = 1024/g" "$PHP_INI_DIR/../php-fpm.d/docker.conf"
  106. ###########################################################################
  107. # Locales:
  108. ###########################################################################
  109. RUN apt update && \
  110. apt install -y locales && \
  111. sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
  112. sed -i 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen && \
  113. locale-gen