Dockerfile 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909
  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. # Note: Base Image name format {image-tag}-{php-version}
  13. #
  14. ARG LARADOCK_PHP_VERSION
  15. FROM laradock/php-fpm:2.6.2-${LARADOCK_PHP_VERSION}
  16. LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
  17. ARG LARADOCK_PHP_VERSION
  18. # Set Environment Variables
  19. ENV DEBIAN_FRONTEND noninteractive
  20. # If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.
  21. ARG CHANGE_SOURCE=false
  22. RUN if [ ${CHANGE_SOURCE} = true ]; then \
  23. # Change application source from deb.debian.org to aliyun source
  24. sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list && \
  25. sed -i 's/security.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list && \
  26. sed -i 's/security-cdn.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list \
  27. ;fi
  28. # always run apt update when start and after add new source list, then clean up at end.
  29. RUN set -xe; \
  30. apt-get update -yqq && \
  31. pecl channel-update pecl.php.net && \
  32. apt-get install -yqq \
  33. apt-utils \
  34. #
  35. #--------------------------------------------------------------------------
  36. # Mandatory Software's Installation
  37. #--------------------------------------------------------------------------
  38. #
  39. # Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
  40. # are installed on the base image 'laradock/php-fpm' image. If you want
  41. # to add more Software's or remove existing one, you need to edit the
  42. # base image (https://github.com/Laradock/php-fpm).
  43. #
  44. # next lines are here becase there is no auto build on dockerhub see https://github.com/laradock/laradock/pull/1903#issuecomment-463142846
  45. libzip-dev zip unzip && \
  46. docker-php-ext-configure zip --with-libzip && \
  47. # Install the zip extension
  48. docker-php-ext-install zip && \
  49. php -m | grep -q 'zip'
  50. #
  51. #--------------------------------------------------------------------------
  52. # Optional Software's Installation
  53. #--------------------------------------------------------------------------
  54. #
  55. # Optional Software's will only be installed if you set them to `true`
  56. # in the `docker-compose.yml` before the build.
  57. # Example:
  58. # - INSTALL_SOAP=true
  59. #
  60. ###########################################################################
  61. # SSH2:
  62. ###########################################################################
  63. ARG INSTALL_SSH2=false
  64. RUN if [ ${INSTALL_SSH2} = true ]; then \
  65. # Install the ssh2 extension
  66. apt-get -y install libssh2-1-dev && \
  67. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  68. pecl install -a ssh2-0.13; \
  69. else \
  70. pecl install -a ssh2-1.1.2; \
  71. fi && \
  72. docker-php-ext-enable ssh2 \
  73. ;fi
  74. ###########################################################################
  75. # libfaketime:
  76. ###########################################################################
  77. USER root
  78. ARG INSTALL_FAKETIME=false
  79. RUN if [ ${INSTALL_FAKETIME} = true ]; then \
  80. apt-get install -y libfaketime \
  81. ;fi
  82. ###########################################################################
  83. # SOAP:
  84. ###########################################################################
  85. ARG INSTALL_SOAP=false
  86. RUN if [ ${INSTALL_SOAP} = true ]; then \
  87. # Install the soap extension
  88. rm /etc/apt/preferences.d/no-debian-php && \
  89. apt-get -y install libxml2-dev php-soap && \
  90. docker-php-ext-install soap \
  91. ;fi
  92. ###########################################################################
  93. # XSL:
  94. ###########################################################################
  95. ARG INSTALL_XSL=false
  96. RUN if [ ${INSTALL_XSL} = true ]; then \
  97. # Install the xsl extension
  98. apt-get -y install libxslt-dev && \
  99. docker-php-ext-install xsl \
  100. ;fi
  101. ###########################################################################
  102. # pgsql
  103. ###########################################################################
  104. ARG INSTALL_PGSQL=false
  105. RUN if [ ${INSTALL_PGSQL} = true ]; then \
  106. # Install the pgsql extension
  107. docker-php-ext-install pgsql \
  108. ;fi
  109. ###########################################################################
  110. # pgsql client
  111. ###########################################################################
  112. ARG INSTALL_PG_CLIENT=false
  113. ARG INSTALL_POSTGIS=false
  114. RUN if [ ${INSTALL_PG_CLIENT} = true ]; then \
  115. # Create folders if not exists (https://github.com/tianon/docker-brew-debian/issues/65)
  116. mkdir -p /usr/share/man/man1 && \
  117. mkdir -p /usr/share/man/man7 && \
  118. # Install the pgsql client
  119. apt-get install -y postgresql-client && \
  120. if [ ${INSTALL_POSTGIS} = true ]; then \
  121. apt-get install -y postgis; \
  122. fi \
  123. ;fi
  124. ###########################################################################
  125. # xDebug:
  126. ###########################################################################
  127. ARG INSTALL_XDEBUG=false
  128. RUN if [ ${INSTALL_XDEBUG} = true ]; then \
  129. # Install the xdebug extension
  130. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  131. pecl install xdebug-2.5.5; \
  132. else \
  133. pecl install xdebug; \
  134. fi && \
  135. docker-php-ext-enable xdebug \
  136. ;fi
  137. # Copy xdebug configuration for remote debugging
  138. COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
  139. RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /usr/local/etc/php/conf.d/xdebug.ini && \
  140. sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /usr/local/etc/php/conf.d/xdebug.ini && \
  141. sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /usr/local/etc/php/conf.d/xdebug.ini
  142. ###########################################################################
  143. # pcov:
  144. ###########################################################################
  145. USER root
  146. ARG INSTALL_PCOV=false
  147. RUN if [ ${INSTALL_PCOV} = true ]; then \
  148. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \
  149. if [ $(php -r "echo PHP_MINOR_VERSION;") != "0" ]; then \
  150. pecl install pcov && \
  151. docker-php-ext-enable pcov \
  152. ;fi \
  153. ;fi \
  154. ;fi
  155. ###########################################################################
  156. # Phpdbg:
  157. ###########################################################################
  158. ARG INSTALL_PHPDBG=false
  159. RUN if [ ${INSTALL_PHPDBG} = true ]; then \
  160. # Load the xdebug extension only with phpunit commands
  161. apt-get install -y --force-yes php${LARADOCK_PHP_VERSION}-phpdbg \
  162. ;fi
  163. ###########################################################################
  164. # Blackfire:
  165. ###########################################################################
  166. ARG INSTALL_BLACKFIRE=false
  167. RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
  168. version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
  169. && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
  170. && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \
  171. && mv /tmp/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
  172. && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
  173. ;fi
  174. ###########################################################################
  175. # PHP REDIS EXTENSION
  176. ###########################################################################
  177. ARG INSTALL_PHPREDIS=false
  178. RUN if [ ${INSTALL_PHPREDIS} = true ]; then \
  179. # Install Php Redis Extension
  180. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  181. pecl install -o -f redis-4.3.0; \
  182. else \
  183. pecl install -o -f redis; \
  184. fi \
  185. && rm -rf /tmp/pear \
  186. && docker-php-ext-enable redis \
  187. ;fi
  188. ###########################################################################
  189. # Swoole EXTENSION
  190. ###########################################################################
  191. ARG INSTALL_SWOOLE=false
  192. RUN if [ ${INSTALL_SWOOLE} = true ]; then \
  193. # Install Php Swoole Extension
  194. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  195. pecl install swoole-2.0.10; \
  196. else \
  197. if [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \
  198. pecl install swoole-2.2.0; \
  199. else \
  200. pecl install swoole; \
  201. fi \
  202. fi && \
  203. docker-php-ext-enable swoole \
  204. && php -m | grep -q 'swoole' \
  205. ;fi
  206. ###########################################################################
  207. # Taint EXTENSION
  208. ###########################################################################
  209. ARG INSTALL_TAINT=false
  210. RUN if [ ${INSTALL_TAINT} = true ]; then \
  211. # Install Php TAINT Extension
  212. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \
  213. pecl install taint && \
  214. docker-php-ext-enable taint && \
  215. php -m | grep -q 'taint'; \
  216. fi \
  217. ;fi
  218. ###########################################################################
  219. # MongoDB:
  220. ###########################################################################
  221. ARG INSTALL_MONGO=false
  222. RUN if [ ${INSTALL_MONGO} = true ]; then \
  223. # Install the mongodb extension
  224. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  225. pecl install mongo && \
  226. docker-php-ext-enable mongo \
  227. ;fi && \
  228. pecl install mongodb && \
  229. docker-php-ext-enable mongodb \
  230. ;fi
  231. ###########################################################################
  232. # Xhprof:
  233. ###########################################################################
  234. ARG INSTALL_XHPROF=false
  235. RUN if [ ${INSTALL_XHPROF} = true ]; then \
  236. # Install the php xhprof extension
  237. if [ $(php -r "echo PHP_MAJOR_VERSION;") = 7 ]; then \
  238. curl -L -o /tmp/xhprof.tar.gz "https://github.com/tideways/php-xhprof-extension/archive/v5.0.1.tar.gz"; \
  239. else \
  240. curl -L -o /tmp/xhprof.tar.gz "https://codeload.github.com/phacility/xhprof/tar.gz/master"; \
  241. fi \
  242. && mkdir -p xhprof \
  243. && tar -C xhprof -zxvf /tmp/xhprof.tar.gz --strip 1 \
  244. && ( \
  245. cd xhprof \
  246. && phpize \
  247. && ./configure \
  248. && make \
  249. && make install \
  250. ) \
  251. && rm -r xhprof \
  252. && rm /tmp/xhprof.tar.gz \
  253. ;fi
  254. COPY ./xhprof.ini /usr/local/etc/php/conf.d
  255. RUN if [ ${INSTALL_XHPROF} = false ]; then \
  256. rm /usr/local/etc/php/conf.d/xhprof.ini \
  257. ;fi
  258. ###########################################################################
  259. # AMQP:
  260. ###########################################################################
  261. ARG INSTALL_AMQP=false
  262. RUN if [ ${INSTALL_AMQP} = true ]; then \
  263. # download and install manually, to make sure it's compatible with ampq installed by pecl later
  264. # install cmake first
  265. apt-get update && apt-get -y install cmake && \
  266. curl -L -o /tmp/rabbitmq-c.tar.gz https://github.com/alanxz/rabbitmq-c/archive/master.tar.gz && \
  267. mkdir -p rabbitmq-c && \
  268. tar -C rabbitmq-c -zxvf /tmp/rabbitmq-c.tar.gz --strip 1 && \
  269. cd rabbitmq-c/ && \
  270. mkdir _build && cd _build/ && \
  271. cmake .. && \
  272. cmake --build . --target install && \
  273. # Install the amqp extension
  274. pecl install amqp && \
  275. docker-php-ext-enable amqp && \
  276. # Install the sockets extension
  277. docker-php-ext-install sockets \
  278. ;fi
  279. ###########################################################################
  280. # GEARMAN:
  281. ###########################################################################
  282. ARG INSTALL_GEARMAN=false
  283. RUN if [ ${INSTALL_GEARMAN} = true ]; then \
  284. apt-get update && \
  285. apt-get -y install libgearman-dev && \
  286. cd /tmp && \
  287. curl -L https://github.com/wcgallego/pecl-gearman/archive/gearman-2.0.5.zip -O && \
  288. unzip gearman-2.0.5.zip && \
  289. mv pecl-gearman-gearman-2.0.5 pecl-gearman && \
  290. cd /tmp/pecl-gearman && \
  291. phpize && \
  292. ./configure && \
  293. make -j$(nproc) && \
  294. make install && \
  295. cd / && \
  296. rm /tmp/gearman-2.0.5.zip && \
  297. rm -r /tmp/pecl-gearman && \
  298. docker-php-ext-enable gearman \
  299. ;fi
  300. ###########################################################################
  301. # pcntl
  302. ###########################################################################
  303. ARG INSTALL_PCNTL=false
  304. RUN if [ ${INSTALL_PCNTL} = true ]; then \
  305. # Installs pcntl, helpful for running Horizon
  306. docker-php-ext-install pcntl \
  307. ;fi
  308. ###########################################################################
  309. # bcmath:
  310. ###########################################################################
  311. ARG INSTALL_BCMATH=false
  312. RUN if [ ${INSTALL_BCMATH} = true ]; then \
  313. # Install the bcmath extension
  314. docker-php-ext-install bcmath \
  315. ;fi
  316. ###########################################################################
  317. # GMP (GNU Multiple Precision):
  318. ###########################################################################
  319. ARG INSTALL_GMP=false
  320. RUN if [ ${INSTALL_GMP} = true ]; then \
  321. # Install the GMP extension
  322. apt-get install -y libgmp-dev && \
  323. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  324. ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h \
  325. ;fi && \
  326. docker-php-ext-install gmp \
  327. ;fi
  328. ###########################################################################
  329. # PHP Memcached:
  330. ###########################################################################
  331. ARG INSTALL_MEMCACHED=false
  332. RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
  333. # Install the php memcached extension
  334. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  335. pecl install memcached-2.2.0; \
  336. else \
  337. pecl install memcached-3.1.3; \
  338. fi \
  339. && docker-php-ext-enable memcached \
  340. ;fi
  341. ###########################################################################
  342. # Exif:
  343. ###########################################################################
  344. ARG INSTALL_EXIF=false
  345. RUN if [ ${INSTALL_EXIF} = true ]; then \
  346. # Enable Exif PHP extentions requirements
  347. docker-php-ext-install exif \
  348. ;fi
  349. ###########################################################################
  350. # PHP Aerospike:
  351. ###########################################################################
  352. USER root
  353. ARG INSTALL_AEROSPIKE=false
  354. RUN set -xe; \
  355. if [ ${INSTALL_AEROSPIKE} = true ]; then \
  356. # Fix dependencies for PHPUnit within aerospike extension
  357. apt-get -y install sudo wget && \
  358. # Install the php aerospike extension
  359. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  360. curl -L -o /tmp/aerospike-client-php.tar.gz https://github.com/aerospike/aerospike-client-php5/archive/master.tar.gz; \
  361. else \
  362. curl -L -o /tmp/aerospike-client-php.tar.gz https://github.com/aerospike/aerospike-client-php/archive/master.tar.gz; \
  363. fi \
  364. && mkdir -p /tmp/aerospike-client-php \
  365. && tar -C /tmp/aerospike-client-php -zxvf /tmp/aerospike-client-php.tar.gz --strip 1 \
  366. && \
  367. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  368. ( \
  369. cd /tmp/aerospike-client-php/src/aerospike \
  370. && phpize \
  371. && ./build.sh \
  372. && make install \
  373. ) \
  374. else \
  375. ( \
  376. cd /tmp/aerospike-client-php/src \
  377. && phpize \
  378. && ./build.sh \
  379. && make install \
  380. ) \
  381. fi \
  382. && rm /tmp/aerospike-client-php.tar.gz \
  383. && docker-php-ext-enable aerospike \
  384. ;fi
  385. ###########################################################################
  386. # PHP OCI8:
  387. ###########################################################################
  388. ARG INSTALL_OCI8=false
  389. ENV LD_LIBRARY_PATH="/opt/oracle/instantclient_12_1"
  390. ENV OCI_HOME="/opt/oracle/instantclient_12_1"
  391. ENV OCI_LIB_DIR="/opt/oracle/instantclient_12_1"
  392. ENV OCI_INCLUDE_DIR="/opt/oracle/instantclient_12_1/sdk/include"
  393. ENV OCI_VERSION=12
  394. RUN if [ ${INSTALL_OCI8} = true ]; then \
  395. # Install wget
  396. apt-get update && apt-get install --no-install-recommends -y wget \
  397. # Install Oracle Instantclient
  398. && mkdir /opt/oracle \
  399. && cd /opt/oracle \
  400. && wget https://github.com/diogomascarenha/oracle-instantclient/raw/master/instantclient-basic-linux.x64-12.1.0.2.0.zip \
  401. && wget https://github.com/diogomascarenha/oracle-instantclient/raw/master/instantclient-sdk-linux.x64-12.1.0.2.0.zip \
  402. && unzip /opt/oracle/instantclient-basic-linux.x64-12.1.0.2.0.zip -d /opt/oracle \
  403. && unzip /opt/oracle/instantclient-sdk-linux.x64-12.1.0.2.0.zip -d /opt/oracle \
  404. && ln -s /opt/oracle/instantclient_12_1/libclntsh.so.12.1 /opt/oracle/instantclient_12_1/libclntsh.so \
  405. && ln -s /opt/oracle/instantclient_12_1/libclntshcore.so.12.1 /opt/oracle/instantclient_12_1/libclntshcore.so \
  406. && ln -s /opt/oracle/instantclient_12_1/libocci.so.12.1 /opt/oracle/instantclient_12_1/libocci.so \
  407. && rm -rf /opt/oracle/*.zip \
  408. # Install PHP extensions deps
  409. && apt-get update \
  410. && apt-get install --no-install-recommends -y \
  411. libaio-dev \
  412. freetds-dev && \
  413. # Install PHP extensions
  414. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  415. echo 'instantclient,/opt/oracle/instantclient_12_1/' | pecl install oci8-2.0.10; \
  416. else \
  417. echo 'instantclient,/opt/oracle/instantclient_12_1/' | pecl install oci8; \
  418. fi \
  419. && docker-php-ext-configure pdo_oci --with-pdo-oci=instantclient,/opt/oracle/instantclient_12_1,12.1 \
  420. && docker-php-ext-configure pdo_dblib --with-libdir=/lib/x86_64-linux-gnu \
  421. && docker-php-ext-install \
  422. pdo_oci \
  423. && docker-php-ext-enable \
  424. oci8 \
  425. ;fi
  426. ###########################################################################
  427. # IonCube Loader:
  428. ###########################################################################
  429. ARG INSTALL_IONCUBE=false
  430. RUN if [ ${INSTALL_IONCUBE} = true ]; then \
  431. # Install the php ioncube loader
  432. curl -L -o /tmp/ioncube_loaders_lin_x86-64.tar.gz https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
  433. && tar zxpf /tmp/ioncube_loaders_lin_x86-64.tar.gz -C /tmp \
  434. && mv /tmp/ioncube/ioncube_loader_lin_${LARADOCK_PHP_VERSION}.so $(php -r "echo ini_get('extension_dir');")/ioncube_loader.so \
  435. && printf "zend_extension=ioncube_loader.so\n" > $PHP_INI_DIR/conf.d/0ioncube.ini \
  436. && rm -rf /tmp/ioncube* \
  437. ;fi
  438. ###########################################################################
  439. # Opcache:
  440. ###########################################################################
  441. ARG INSTALL_OPCACHE=false
  442. RUN if [ ${INSTALL_OPCACHE} = true ]; then \
  443. docker-php-ext-install opcache \
  444. ;fi
  445. # Copy opcache configration
  446. COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
  447. ###########################################################################
  448. # Mysqli Modifications:
  449. ###########################################################################
  450. ARG INSTALL_MYSQLI=false
  451. RUN if [ ${INSTALL_MYSQLI} = true ]; then \
  452. docker-php-ext-install mysqli \
  453. ;fi
  454. ###########################################################################
  455. # Human Language and Character Encoding Support:
  456. ###########################################################################
  457. ARG INSTALL_INTL=false
  458. RUN if [ ${INSTALL_INTL} = true ]; then \
  459. # Install intl and requirements
  460. apt-get install -y zlib1g-dev libicu-dev g++ && \
  461. docker-php-ext-configure intl && \
  462. docker-php-ext-install intl \
  463. ;fi
  464. ###########################################################################
  465. # GHOSTSCRIPT:
  466. ###########################################################################
  467. ARG INSTALL_GHOSTSCRIPT=false
  468. RUN if [ ${INSTALL_GHOSTSCRIPT} = true ]; then \
  469. # Install the ghostscript extension
  470. # for PDF editing
  471. apt-get install -y \
  472. poppler-utils \
  473. ghostscript \
  474. ;fi
  475. ###########################################################################
  476. # LDAP:
  477. ###########################################################################
  478. ARG INSTALL_LDAP=false
  479. RUN if [ ${INSTALL_LDAP} = true ]; then \
  480. apt-get install -y libldap2-dev && \
  481. docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ && \
  482. docker-php-ext-install ldap \
  483. ;fi
  484. ###########################################################################
  485. # SQL SERVER:
  486. ###########################################################################
  487. ARG INSTALL_MSSQL=false
  488. RUN set -eux; \
  489. if [ ${INSTALL_MSSQL} = true ]; then \
  490. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  491. apt-get -y install freetds-dev libsybdb5 \
  492. && ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/libsybdb.so \
  493. && docker-php-ext-install mssql pdo_dblib \
  494. && php -m | grep -q 'mssql' \
  495. && php -m | grep -q 'pdo_dblib' \
  496. ;else \
  497. ###########################################################################
  498. # Ref from https://github.com/Microsoft/msphpsql/wiki/Dockerfile-for-adding-pdo_sqlsrv-and-sqlsrv-to-official-php-image
  499. ###########################################################################
  500. # Add Microsoft repo for Microsoft ODBC Driver 13 for Linux
  501. apt-get install -y apt-transport-https gnupg \
  502. && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
  503. && curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \
  504. && apt-get update -yqq \
  505. # Install Dependencies
  506. && ACCEPT_EULA=Y apt-get install -y unixodbc unixodbc-dev libgss3 odbcinst msodbcsql17 locales \
  507. && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
  508. # link local aliases
  509. && ln -sfn /etc/locale.alias /usr/share/locale/locale.alias \
  510. && locale-gen \
  511. # Install pdo_sqlsrv and sqlsrv from PECL. Replace pdo_sqlsrv-4.1.8preview with preferred version.
  512. && if [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \
  513. pecl install pdo_sqlsrv-5.3.0 sqlsrv-5.3.0 \
  514. ;else \
  515. pecl install pdo_sqlsrv sqlsrv \
  516. ;fi \
  517. && docker-php-ext-enable pdo_sqlsrv sqlsrv \
  518. && php -m | grep -q 'pdo_sqlsrv' \
  519. && php -m | grep -q 'sqlsrv' \
  520. ;fi \
  521. ;fi
  522. ###########################################################################
  523. # Image optimizers:
  524. ###########################################################################
  525. USER root
  526. ARG INSTALL_IMAGE_OPTIMIZERS=false
  527. RUN if [ ${INSTALL_IMAGE_OPTIMIZERS} = true ]; then \
  528. apt-get install -y jpegoptim optipng pngquant gifsicle \
  529. ;fi
  530. ###########################################################################
  531. # ImageMagick:
  532. ###########################################################################
  533. USER root
  534. ARG INSTALL_IMAGEMAGICK=false
  535. RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \
  536. apt-get install -y libmagickwand-dev imagemagick && \
  537. pecl install imagick && \
  538. docker-php-ext-enable imagick \
  539. ;fi
  540. ###########################################################################
  541. # IMAP:
  542. ###########################################################################
  543. ARG INSTALL_IMAP=false
  544. RUN if [ ${INSTALL_IMAP} = true ]; then \
  545. apt-get install -y libc-client-dev libkrb5-dev && \
  546. docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \
  547. docker-php-ext-install imap \
  548. ;fi
  549. ###########################################################################
  550. # Calendar:
  551. ###########################################################################
  552. USER root
  553. ARG INSTALL_CALENDAR=false
  554. RUN if [ ${INSTALL_CALENDAR} = true ]; then \
  555. docker-php-ext-configure calendar && \
  556. docker-php-ext-install calendar \
  557. ;fi
  558. ###########################################################################
  559. # Phalcon:
  560. ###########################################################################
  561. ARG INSTALL_PHALCON=false
  562. ARG LARADOCK_PHALCON_VERSION
  563. ENV LARADOCK_PHALCON_VERSION ${LARADOCK_PHALCON_VERSION}
  564. # Copy phalcon configration
  565. COPY ./phalcon.ini /usr/local/etc/php/conf.d/phalcon.ini.disable
  566. RUN if [ $INSTALL_PHALCON = true ]; then \
  567. apt-get update && apt-get install -y unzip libpcre3-dev gcc make re2c \
  568. && curl -L -o /tmp/cphalcon.zip https://github.com/phalcon/cphalcon/archive/v${LARADOCK_PHALCON_VERSION}.zip \
  569. && unzip -d /tmp/ /tmp/cphalcon.zip \
  570. && cd /tmp/cphalcon-${LARADOCK_PHALCON_VERSION}/build \
  571. && ./install \
  572. && mv /usr/local/etc/php/conf.d/phalcon.ini.disable /usr/local/etc/php/conf.d/phalcon.ini \
  573. && rm -rf /tmp/cphalcon* \
  574. ;fi
  575. ###########################################################################
  576. # APCU:
  577. ###########################################################################
  578. ARG INSTALL_APCU=false
  579. RUN if [ ${INSTALL_APCU} = true ]; then \
  580. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  581. pecl install -a apcu-4.0.11; \
  582. else \
  583. pecl install apcu; \
  584. fi && \
  585. docker-php-ext-enable apcu \
  586. ;fi
  587. ###########################################################################
  588. # YAML:
  589. ###########################################################################
  590. USER root
  591. ARG INSTALL_YAML=false
  592. RUN if [ ${INSTALL_YAML} = true ]; then \
  593. apt-get install libyaml-dev -y ; \
  594. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  595. pecl install -a yaml-1.3.2; \
  596. else \
  597. pecl install yaml; \
  598. fi && \
  599. docker-php-ext-enable yaml \
  600. ;fi
  601. ###########################################################################
  602. # RDKAFKA:
  603. ###########################################################################
  604. ARG INSTALL_RDKAFKA=false
  605. RUN if [ ${INSTALL_RDKAFKA} = true ]; then \
  606. apt-get install -y librdkafka-dev && \
  607. pecl install rdkafka && \
  608. docker-php-ext-enable rdkafka \
  609. ;fi
  610. ###########################################################################
  611. # GETTEXT:
  612. ###########################################################################
  613. ARG INSTALL_GETTEXT=false
  614. RUN if [ ${INSTALL_GETTEXT} = true ]; then \
  615. apt-get install -y zlib1g-dev libicu-dev g++ libpq-dev libssl-dev gettext && \
  616. docker-php-ext-install gettext \
  617. ;fi
  618. ###########################################################################
  619. # Install additional locales:
  620. ###########################################################################
  621. ARG INSTALL_ADDITIONAL_LOCALES=false
  622. ARG ADDITIONAL_LOCALES
  623. RUN if [ ${INSTALL_ADDITIONAL_LOCALES} = true ]; then \
  624. apt-get install -y locales \
  625. && echo '' >> /usr/share/locale/locale.alias \
  626. && temp="${ADDITIONAL_LOCALES%\"}" \
  627. && temp="${temp#\"}" \
  628. && for i in ${temp}; do sed -i "/$i/s/^#//g" /etc/locale.gen; done \
  629. && locale-gen \
  630. ;fi
  631. ###########################################################################
  632. # MySQL Client:
  633. ###########################################################################
  634. USER root
  635. ARG INSTALL_MYSQL_CLIENT=false
  636. RUN if [ ${INSTALL_MYSQL_CLIENT} = true ]; then \
  637. apt-get update -yqq && \
  638. if [ ${LARADOCK_PHP_VERSION} = "7.3" ]; then \
  639. apt-get -y install default-mysql-client \
  640. ;else \
  641. apt-get -y install mysql-client \
  642. ;fi \
  643. ;fi
  644. ###########################################################################
  645. # ping:
  646. ###########################################################################
  647. USER root
  648. ARG INSTALL_PING=false
  649. RUN if [ ${INSTALL_PING} = true ]; then \
  650. apt-get update -yqq && \
  651. apt-get -y install inetutils-ping \
  652. ;fi
  653. ###########################################################################
  654. # sshpass:
  655. ###########################################################################
  656. USER root
  657. ARG INSTALL_SSHPASS=false
  658. RUN if [ ${INSTALL_SSHPASS} = true ]; then \
  659. apt-get update -yqq && \
  660. apt-get -y install sshpass \
  661. ;fi
  662. ###########################################################################
  663. # FFMPEG:
  664. ###########################################################################
  665. USER root
  666. ARG INSTALL_FFMPEG=false
  667. RUN if [ ${INSTALL_FFMPEG} = true ]; then \
  668. apt-get update -yqq && \
  669. apt-get -y install ffmpeg \
  670. ;fi
  671. ###########################################################################
  672. # Mailparse extension:
  673. ###########################################################################
  674. ARG INSTALL_MAILPARSE=false
  675. RUN if [ ${INSTALL_MAILPARSE} = true ]; then \
  676. # Install mailparse extension
  677. printf "\n" | pecl install -o -f mailparse \
  678. && rm -rf /tmp/pear \
  679. && docker-php-ext-enable mailparse \
  680. ;fi
  681. ###########################################################################
  682. # CacheTool:
  683. ###########################################################################
  684. ARG INSTALL_CACHETOOL=false
  685. RUN if [ ${INSTALL_CACHETOOL} = true ]; then \
  686. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") -ge 1 ]; then \
  687. curl -sO http://gordalina.github.io/cachetool/downloads/cachetool.phar; \
  688. else \
  689. curl http://gordalina.github.io/cachetool/downloads/cachetool-3.2.1.phar -o cachetool.phar; \
  690. fi && \
  691. chmod +x cachetool.phar && \
  692. mv cachetool.phar /usr/local/bin/cachetool \
  693. ;fi
  694. ###########################################################################
  695. # Check PHP version:
  696. ###########################################################################
  697. RUN set -xe; php -v | head -n 1 | grep -q "PHP ${LARADOCK_PHP_VERSION}."
  698. #
  699. #--------------------------------------------------------------------------
  700. # Final Touch
  701. #--------------------------------------------------------------------------
  702. #
  703. COPY ./laravel.ini /usr/local/etc/php/conf.d
  704. COPY ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
  705. USER root
  706. # Clean up
  707. RUN apt-get clean && \
  708. rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
  709. rm /var/log/lastlog /var/log/faillog
  710. # Configure non-root user.
  711. ARG PUID=1000
  712. ENV PUID ${PUID}
  713. ARG PGID=1000
  714. ENV PGID ${PGID}
  715. RUN groupmod -o -g ${PGID} www-data && \
  716. usermod -o -u ${PUID} -g www-data www-data
  717. # Adding the faketime library to the preload file needs to be done last
  718. # otherwise it will preload it for all commands that follow in this file
  719. RUN if [ ${INSTALL_FAKETIME} = true ]; then \
  720. echo "/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1" > /etc/ld.so.preload \
  721. ;fi
  722. # Configure locale.
  723. ARG LOCALE=POSIX
  724. ENV LC_ALL ${LOCALE}
  725. WORKDIR /var/www
  726. CMD ["php-fpm"]
  727. EXPOSE 9000