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.

126 lines
4.3 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
  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. # Zip:
  29. ###########################################################################
  30. ARG INSTALL_ZIP=false
  31. RUN if [ ${INSTALL_ZIP} = true ]; then \
  32. apt update && apt install -y libzip-dev \
  33. && docker-php-ext-install zip \
  34. && docker-php-ext-enable zip \
  35. ;fi
  36. ###########################################################################
  37. # BZ2:
  38. ###########################################################################
  39. ARG INSTALL_BZ2=false
  40. RUN if [ ${INSTALL_BZ2} = true ]; then \
  41. apt update && apt install -y libbz2-ocaml-dev \
  42. && docker-php-ext-install bz2 \
  43. && docker-php-ext-enable bz2 \
  44. ;fi
  45. ###########################################################################
  46. # INTL:
  47. ###########################################################################
  48. ARG INSTALL_INTL=false
  49. RUN if [ ${INSTALL_INTL} = true ]; then \
  50. apt update && apt install -y libicu-dev \
  51. && docker-php-ext-install intl \
  52. && docker-php-ext-enable intl \
  53. ;fi
  54. ###########################################################################
  55. # PGSQL:
  56. ###########################################################################
  57. ARG INSTALL_PGSQL=false
  58. RUN if [ ${INSTALL_PGSQL} = true ]; then \
  59. apt update && apt install -y libpq-dev \
  60. && docker-php-ext-install pgsql \
  61. && docker-php-ext-install pdo_pgsql \
  62. ;fi
  63. ###########################################################################
  64. # BCMATH:
  65. ###########################################################################
  66. ARG INSTALL_BCMATH=false
  67. RUN if [ ${INSTALL_BCMATH} = true ]; then \
  68. docker-php-ext-install bcmath \
  69. ;fi
  70. ###########################################################################
  71. # Prepend nginx 502 on showing errors:
  72. # @see https://stackoverflow.com/questions/55260221/laravel-php-7-3-nginx-502-upstream-prematurely-closed-fastcgi-stdout
  73. ###########################################################################
  74. RUN sed -i "s/^log_limit = .*/log_limit = 1024/g" "$PHP_INI_DIR/../php-fpm.d/docker.conf"
  75. ###########################################################################
  76. # php.ini opts:
  77. ###########################################################################
  78. # https://github.com/php/php-src/blob/master/php.ini-development
  79. RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
  80. ARG PHP_OPT_SHORT_OPEN_TAG=Off
  81. RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" "$PHP_INI_DIR/php.ini"
  82. ARG PHP_OPT_MAX_EXECUTION_TIME=30
  83. RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTION_TIME/g" "$PHP_INI_DIR/php.ini"
  84. ARG PHP_OPT_MEMORY_LIMIT=128M
  85. RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini"
  86. ARG PHP_OPT_UPLOAD_MAX_FILESIZE=2M
  87. RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
  88. ###########################################################################
  89. # Locales:
  90. ###########################################################################
  91. RUN apt update && \
  92. apt install -y locales && \
  93. sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
  94. sed -i 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen && \
  95. locale-gen