Dockerfile-71 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. #
  2. #--------------------------------------------------------------------------
  3. # Image Setup
  4. #--------------------------------------------------------------------------
  5. #
  6. # To edit the 'php-fpm' base Image, visit its repository on Github
  7. # https://github.com/LaraDock/php-fpm
  8. #
  9. # To change its version, see the available Tags on the Docker Hub:
  10. # https://hub.docker.com/r/laradock/php-fpm/tags/
  11. #
  12. FROM laradock/php-fpm:7.1--1.4
  13. MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
  14. #
  15. #--------------------------------------------------------------------------
  16. # Mandatory Software's Installation
  17. #--------------------------------------------------------------------------
  18. #
  19. # Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
  20. # are installed on the base image 'laradock/php-fpm' image. If you want
  21. # to add more Software's or remove existing one, you need to edit the
  22. # base image (https://github.com/LaraDock/php-fpm).
  23. #
  24. #
  25. #--------------------------------------------------------------------------
  26. # Optional Software's Installation
  27. #--------------------------------------------------------------------------
  28. #
  29. # Optional Software's will only be installed if you set them to `true`
  30. # in the `docker-compose.yml` before the build.
  31. # Example:
  32. # - INSTALL_ZIP_ARCHIVE=true
  33. #
  34. #####################################
  35. # SOAP:
  36. #####################################
  37. ARG INSTALL_SOAP=false
  38. RUN if [ ${INSTALL_SOAP} = true ]; then \
  39. # Install the soap extension
  40. apt-get -y update && \
  41. apt-get -y install libxml2-dev php-soap && \
  42. docker-php-ext-install soap \
  43. ;fi
  44. #####################################
  45. # xDebug:
  46. #####################################
  47. ARG INSTALL_XDEBUG=false
  48. RUN if [ ${INSTALL_XDEBUG} = true ]; then \
  49. # Install the xdebug extension
  50. pecl install xdebug && \
  51. docker-php-ext-enable xdebug \
  52. ;fi
  53. # Copy xdebug configration for remote debugging
  54. COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
  55. #####################################
  56. # Blackfire:
  57. #####################################
  58. ARG INSTALL_BLACKFIRE=false
  59. RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
  60. version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
  61. && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
  62. && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \
  63. && mv /tmp/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
  64. && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
  65. ;fi
  66. #####################################
  67. # PHP REDIS EXTENSION FOR PHP 7
  68. #####################################
  69. ARG INSTALL_PHPREDIS=false
  70. RUN if [ ${INSTALL_PHPREDIS} = true ]; then \
  71. # Install Php Redis Extension
  72. pecl install -o -f redis \
  73. && rm -rf /tmp/pear \
  74. && docker-php-ext-enable redis \
  75. ;fi
  76. #####################################
  77. # MongoDB:
  78. #####################################
  79. ARG INSTALL_MONGO=false
  80. RUN if [ ${INSTALL_MONGO} = true ]; then \
  81. # Install the mongodb extension
  82. pecl install mongodb && \
  83. docker-php-ext-enable mongodb \
  84. ;fi
  85. #####################################
  86. # ZipArchive:
  87. #####################################
  88. ARG INSTALL_ZIP_ARCHIVE=false
  89. RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \
  90. # Install the zip extension
  91. docker-php-ext-install zip \
  92. ;fi
  93. #####################################
  94. # bcmath:
  95. #####################################
  96. ARG INSTALL_BCMATH=false
  97. RUN if [ ${INSTALL_BCMATH} = true ]; then \
  98. # Install the bcmath extension
  99. docker-php-ext-install bcmath \
  100. ;fi
  101. #####################################
  102. # PHP Memcached:
  103. #####################################
  104. ARG INSTALL_MEMCACHED=false
  105. RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
  106. # Install the php memcached extension
  107. curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \
  108. && mkdir -p memcached \
  109. && tar -C memcached -zxvf /tmp/memcached.tar.gz --strip 1 \
  110. && ( \
  111. cd memcached \
  112. && phpize \
  113. && ./configure \
  114. && make -j$(nproc) \
  115. && make install \
  116. ) \
  117. && rm -r memcached \
  118. && rm /tmp/memcached.tar.gz \
  119. && docker-php-ext-enable memcached \
  120. ;fi
  121. #####################################
  122. # Exif:
  123. #####################################
  124. ARG INSTALL_EXIF=false
  125. RUN if [ ${INSTALL_EXIF} = true ]; then \
  126. # Enable Exif PHP extentions requirements
  127. docker-php-ext-install exif \
  128. ;fi
  129. #####################################
  130. # PHP Aerospike:
  131. #####################################
  132. ARG INSTALL_AEROSPIKE_EXTENSION=false
  133. ENV INSTALL_AEROSPIKE_EXTENSION ${INSTALL_AEROSPIKE_EXTENSION}
  134. # Copy aerospike configration for remote debugging
  135. COPY ./aerospike.ini /usr/local/etc/php/conf.d/aerospike.ini
  136. RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \
  137. # Install the php aerospike extension
  138. curl -L -o /tmp/aerospike-client-php.tar.gz "https://github.com/luciano-jr/aerospike-client-php/archive/master.tar.gz" \
  139. && mkdir -p aerospike-client-php \
  140. && tar -C aerospike-client-php -zxvf /tmp/aerospike-client-php.tar.gz --strip 1 \
  141. && ( \
  142. cd aerospike-client-php/src/aerospike \
  143. && phpize \
  144. && ./build.sh \
  145. && make install \
  146. ) \
  147. && rm /tmp/aerospike-client-php.tar.gz \
  148. && docker-php-ext-enable aerospike \
  149. ;fi
  150. #####################################
  151. # Opcache:
  152. #####################################
  153. ARG INSTALL_OPCACHE=false
  154. RUN if [ ${INSTALL_OPCACHE} = true ]; then \
  155. docker-php-ext-install opcache \
  156. ;fi
  157. # Copy opcache configration
  158. COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
  159. #####################################
  160. # Mysqli Modifications:
  161. #####################################
  162. ARG INSTALL_MYSQLI=false
  163. RUN if [ ${INSTALL_MYSQLI} = true ]; then \
  164. docker-php-ext-install mysqli \
  165. ;fi
  166. #####################################
  167. # Tokenizer Modifications:
  168. #####################################
  169. ARG INSTALL_TOKENIZER=false
  170. RUN if [ ${INSTALL_TOKENIZER} = true ]; then \
  171. docker-php-ext-install tokenizer \
  172. ;fi
  173. #####################################
  174. # Human Language and Character Encoding Support:
  175. #####################################
  176. ARG INSTALL_INTL=false
  177. RUN if [ ${INSTALL_INTL} = true ]; then \
  178. # Install intl and requirements
  179. apt-get install -y zlib1g-dev libicu-dev g++ && \
  180. docker-php-ext-configure intl && \
  181. docker-php-ext-install intl \
  182. ;fi
  183. #####################################
  184. # GHOSTSCRIPT:
  185. #####################################
  186. ARG INSTALL_GHOSTSCRIPT=false
  187. RUN if [ ${INSTALL_GHOSTSCRIPT} = true ]; then \
  188. # Install the ghostscript extension
  189. # for PDF editing
  190. apt-get -y update \
  191. && apt-get install -y \
  192. poppler-utils \
  193. ghostscript \
  194. ;fi
  195. #
  196. #--------------------------------------------------------------------------
  197. # Final Touch
  198. #--------------------------------------------------------------------------
  199. #
  200. ADD ./laravel.ini /usr/local/etc/php/conf.d
  201. ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/
  202. #RUN rm -r /var/lib/apt/lists/*
  203. RUN usermod -u 1000 www-data
  204. WORKDIR /var/www
  205. CMD ["php-fpm"]
  206. EXPOSE 9000