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.

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