Dockerfile 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  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.2-${LARADOCK_PHP_VERSION}
  16. FROM letsdockerize/laradock-php-fpm:2.4-${LARADOCK_PHP_VERSION}
  17. LABEL maintainer="Mahmoud Zalt <mahmoud@zalt.me>"
  18. ARG LARADOCK_PHP_VERSION
  19. # Set Environment Variables
  20. ENV DEBIAN_FRONTEND noninteractive
  21. # always run apt update when start and after add new source list, then clean up at end.
  22. RUN set -xe; \
  23. apt-get update -yqq && \
  24. pecl channel-update pecl.php.net && \
  25. apt-get install -yqq \
  26. apt-utils \
  27. #
  28. #--------------------------------------------------------------------------
  29. # Mandatory Software's Installation
  30. #--------------------------------------------------------------------------
  31. #
  32. # Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
  33. # are installed on the base image 'laradock/php-fpm' image. If you want
  34. # to add more Software's or remove existing one, you need to edit the
  35. # base image (https://github.com/Laradock/php-fpm).
  36. #
  37. # next lines are here becase there is no auto build on dockerhub see https://github.com/laradock/laradock/pull/1903#issuecomment-463142846
  38. libzip-dev zip unzip && \
  39. docker-php-ext-configure zip --with-libzip && \
  40. # Install the zip extension
  41. docker-php-ext-install zip && \
  42. php -m | grep -q 'zip'
  43. #
  44. #--------------------------------------------------------------------------
  45. # Optional Software's Installation
  46. #--------------------------------------------------------------------------
  47. #
  48. # Optional Software's will only be installed if you set them to `true`
  49. # in the `docker-compose.yml` before the build.
  50. # Example:
  51. # - INSTALL_SOAP=true
  52. #
  53. ###########################################################################
  54. # SSH2:
  55. ###########################################################################
  56. ARG INSTALL_SSH2=false
  57. RUN if [ ${INSTALL_SSH2} = true ]; then \
  58. # Install the ssh2 extension
  59. apt-get -y install libssh2-1-dev && \
  60. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  61. pecl install -a ssh2-0.13; \
  62. else \
  63. pecl install -a ssh2-1.1.2; \
  64. fi && \
  65. docker-php-ext-enable ssh2 \
  66. ;fi
  67. ###########################################################################
  68. # libfaketime:
  69. ###########################################################################
  70. USER root
  71. ARG INSTALL_FAKETIME=false
  72. RUN if [ ${INSTALL_FAKETIME} = true ]; then \
  73. apt-get install -y libfaketime \
  74. ;fi
  75. ###########################################################################
  76. # SOAP:
  77. ###########################################################################
  78. ARG INSTALL_SOAP=false
  79. RUN if [ ${INSTALL_SOAP} = true ]; then \
  80. # Install the soap extension
  81. rm /etc/apt/preferences.d/no-debian-php && \
  82. apt-get -y install libxml2-dev php-soap && \
  83. docker-php-ext-install soap \
  84. ;fi
  85. ###########################################################################
  86. # XSL:
  87. ###########################################################################
  88. ARG INSTALL_XSL=false
  89. RUN if [ ${INSTALL_XSL} = true ]; then \
  90. # Install the xsl extension
  91. apt-get -y install libxslt-dev && \
  92. docker-php-ext-install xsl \
  93. ;fi
  94. ###########################################################################
  95. # pgsql
  96. ###########################################################################
  97. ARG INSTALL_PGSQL=false
  98. RUN if [ ${INSTALL_PGSQL} = true ]; then \
  99. # Install the pgsql extension
  100. docker-php-ext-install pgsql \
  101. ;fi
  102. ###########################################################################
  103. # pgsql client
  104. ###########################################################################
  105. ARG INSTALL_PG_CLIENT=false
  106. RUN if [ ${INSTALL_PG_CLIENT} = true ]; then \
  107. # Create folders if not exists (https://github.com/tianon/docker-brew-debian/issues/65)
  108. mkdir -p /usr/share/man/man1 && \
  109. mkdir -p /usr/share/man/man7 && \
  110. # Install the pgsql client
  111. apt-get install -y postgresql-client \
  112. ;fi
  113. ###########################################################################
  114. # xDebug:
  115. ###########################################################################
  116. ARG INSTALL_XDEBUG=false
  117. RUN if [ ${INSTALL_XDEBUG} = true ]; then \
  118. # Install the xdebug extension
  119. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  120. pecl install xdebug-2.5.5; \
  121. else \
  122. pecl install xdebug; \
  123. fi && \
  124. docker-php-ext-enable xdebug \
  125. ;fi
  126. # Copy xdebug configuration for remote debugging
  127. COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
  128. RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /usr/local/etc/php/conf.d/xdebug.ini && \
  129. sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /usr/local/etc/php/conf.d/xdebug.ini && \
  130. sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /usr/local/etc/php/conf.d/xdebug.ini
  131. ###########################################################################
  132. # Phpdbg:
  133. ###########################################################################
  134. ARG INSTALL_PHPDBG=false
  135. RUN if [ ${INSTALL_PHPDBG} = true ]; then \
  136. # Load the xdebug extension only with phpunit commands
  137. apt-get install -y --force-yes php${LARADOCK_PHP_VERSION}-phpdbg \
  138. ;fi
  139. ###########################################################################
  140. # Blackfire:
  141. ###########################################################################
  142. ARG INSTALL_BLACKFIRE=false
  143. RUN if [ ${INSTALL_XDEBUG} = false -a ${INSTALL_BLACKFIRE} = true ]; then \
  144. version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
  145. && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
  146. && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \
  147. && mv /tmp/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
  148. && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8707\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
  149. ;fi
  150. ###########################################################################
  151. # PHP REDIS EXTENSION
  152. ###########################################################################
  153. ARG INSTALL_PHPREDIS=false
  154. RUN if [ ${INSTALL_PHPREDIS} = true ]; then \
  155. # Install Php Redis Extension
  156. printf "\n" | pecl install -o -f redis \
  157. && rm -rf /tmp/pear \
  158. && docker-php-ext-enable redis \
  159. ;fi
  160. ###########################################################################
  161. # Swoole EXTENSION
  162. ###########################################################################
  163. ARG INSTALL_SWOOLE=false
  164. RUN if [ ${INSTALL_SWOOLE} = true ]; then \
  165. # Install Php Swoole Extension
  166. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  167. pecl install swoole-2.0.10; \
  168. else \
  169. if [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \
  170. pecl install swoole-2.2.0; \
  171. else \
  172. pecl install swoole; \
  173. fi \
  174. fi && \
  175. docker-php-ext-enable swoole \
  176. && php -m | grep -q 'swoole' \
  177. ;fi
  178. ###########################################################################
  179. # MongoDB:
  180. ###########################################################################
  181. ARG INSTALL_MONGO=false
  182. RUN if [ ${INSTALL_MONGO} = true ]; then \
  183. # Install the mongodb extension
  184. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  185. pecl install mongo && \
  186. docker-php-ext-enable mongo \
  187. ;fi && \
  188. pecl install mongodb && \
  189. docker-php-ext-enable mongodb \
  190. ;fi
  191. ###########################################################################
  192. # AMQP:
  193. ###########################################################################
  194. ARG INSTALL_AMQP=false
  195. RUN if [ ${INSTALL_AMQP} = true ]; then \
  196. # download and install manually, to make sure it's compatible with ampq installed by pecl later
  197. # install cmake first
  198. apt-get update && apt-get -y install cmake && \
  199. curl -L -o /tmp/rabbitmq-c.tar.gz https://github.com/alanxz/rabbitmq-c/archive/master.tar.gz && \
  200. mkdir -p rabbitmq-c && \
  201. tar -C rabbitmq-c -zxvf /tmp/rabbitmq-c.tar.gz --strip 1 && \
  202. cd rabbitmq-c/ && \
  203. mkdir _build && cd _build/ && \
  204. cmake .. && \
  205. cmake --build . --target install && \
  206. # Install the amqp extension
  207. pecl install amqp && \
  208. docker-php-ext-enable amqp && \
  209. # Install the sockets extension
  210. docker-php-ext-install sockets \
  211. ;fi
  212. ###########################################################################
  213. # pcntl
  214. ###########################################################################
  215. ARG INSTALL_PCNTL=false
  216. RUN if [ ${INSTALL_PCNTL} = true ]; then \
  217. # Installs pcntl, helpful for running Horizon
  218. docker-php-ext-install pcntl \
  219. ;fi
  220. ###########################################################################
  221. # bcmath:
  222. ###########################################################################
  223. ARG INSTALL_BCMATH=false
  224. RUN if [ ${INSTALL_BCMATH} = true ]; then \
  225. # Install the bcmath extension
  226. docker-php-ext-install bcmath \
  227. ;fi
  228. ###########################################################################
  229. # GMP (GNU Multiple Precision):
  230. ###########################################################################
  231. ARG INSTALL_GMP=false
  232. RUN if [ ${INSTALL_GMP} = true ]; then \
  233. # Install the GMP extension
  234. apt-get install -y libgmp-dev && \
  235. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  236. ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h \
  237. ;fi && \
  238. docker-php-ext-install gmp \
  239. ;fi
  240. ###########################################################################
  241. # PHP Memcached:
  242. ###########################################################################
  243. ARG INSTALL_MEMCACHED=false
  244. RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
  245. # Install the php memcached extension
  246. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  247. curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/2.2.0.tar.gz"; \
  248. else \
  249. curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz"; \
  250. fi \
  251. && mkdir -p memcached \
  252. && tar -C memcached -zxvf /tmp/memcached.tar.gz --strip 1 \
  253. && ( \
  254. cd memcached \
  255. && phpize \
  256. && ./configure \
  257. && make -j$(nproc) \
  258. && make install \
  259. ) \
  260. && rm -r memcached \
  261. && rm /tmp/memcached.tar.gz \
  262. && docker-php-ext-enable memcached \
  263. ;fi
  264. ###########################################################################
  265. # Exif:
  266. ###########################################################################
  267. ARG INSTALL_EXIF=false
  268. RUN if [ ${INSTALL_EXIF} = true ]; then \
  269. # Enable Exif PHP extentions requirements
  270. docker-php-ext-install exif \
  271. ;fi
  272. ###########################################################################
  273. # PHP Aerospike:
  274. ###########################################################################
  275. USER root
  276. ARG INSTALL_AEROSPIKE=false
  277. RUN set -xe; \
  278. if [ ${INSTALL_AEROSPIKE} = true ]; then \
  279. # Fix dependencies for PHPUnit within aerospike extension
  280. apt-get -y install sudo wget && \
  281. # Install the php aerospike extension
  282. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  283. curl -L -o /tmp/aerospike-client-php.tar.gz https://github.com/aerospike/aerospike-client-php5/archive/master.tar.gz; \
  284. else \
  285. curl -L -o /tmp/aerospike-client-php.tar.gz https://github.com/aerospike/aerospike-client-php/archive/master.tar.gz; \
  286. fi \
  287. && mkdir -p /tmp/aerospike-client-php \
  288. && tar -C /tmp/aerospike-client-php -zxvf /tmp/aerospike-client-php.tar.gz --strip 1 \
  289. && \
  290. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  291. ( \
  292. cd /tmp/aerospike-client-php/src/aerospike \
  293. && phpize \
  294. && ./build.sh \
  295. && make install \
  296. ) \
  297. else \
  298. ( \
  299. cd /tmp/aerospike-client-php/src \
  300. && phpize \
  301. && ./build.sh \
  302. && make install \
  303. ) \
  304. fi \
  305. && rm /tmp/aerospike-client-php.tar.gz \
  306. && docker-php-ext-enable aerospike \
  307. ;fi
  308. ###########################################################################
  309. # IonCube Loader:
  310. ###########################################################################
  311. ARG INSTALL_IONCUBE=false
  312. RUN if [ ${INSTALL_IONCUBE} = true ]; then \
  313. # Install the php ioncube loader
  314. curl -L -o /tmp/ioncube_loaders_lin_x86-64.tar.gz https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
  315. && tar zxpf /tmp/ioncube_loaders_lin_x86-64.tar.gz -C /tmp \
  316. && mv /tmp/ioncube/ioncube_loader_lin_${LARADOCK_PHP_VERSION}.so $(php -r "echo ini_get('extension_dir');")/ioncube_loader.so \
  317. && printf "zend_extension=ioncube_loader.so\n" > $PHP_INI_DIR/conf.d/0ioncube.ini \
  318. && rm -rf /tmp/ioncube* \
  319. ;fi
  320. ###########################################################################
  321. # Opcache:
  322. ###########################################################################
  323. ARG INSTALL_OPCACHE=false
  324. RUN if [ ${INSTALL_OPCACHE} = true ]; then \
  325. docker-php-ext-install opcache \
  326. ;fi
  327. # Copy opcache configration
  328. COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
  329. ###########################################################################
  330. # Mysqli Modifications:
  331. ###########################################################################
  332. ARG INSTALL_MYSQLI=false
  333. RUN if [ ${INSTALL_MYSQLI} = true ]; then \
  334. docker-php-ext-install mysqli \
  335. ;fi
  336. ###########################################################################
  337. # Human Language and Character Encoding Support:
  338. ###########################################################################
  339. ARG INSTALL_INTL=false
  340. RUN if [ ${INSTALL_INTL} = true ]; then \
  341. # Install intl and requirements
  342. apt-get install -y zlib1g-dev libicu-dev g++ && \
  343. docker-php-ext-configure intl && \
  344. docker-php-ext-install intl \
  345. ;fi
  346. ###########################################################################
  347. # GHOSTSCRIPT:
  348. ###########################################################################
  349. ARG INSTALL_GHOSTSCRIPT=false
  350. RUN if [ ${INSTALL_GHOSTSCRIPT} = true ]; then \
  351. # Install the ghostscript extension
  352. # for PDF editing
  353. apt-get install -y \
  354. poppler-utils \
  355. ghostscript \
  356. ;fi
  357. ###########################################################################
  358. # LDAP:
  359. ###########################################################################
  360. ARG INSTALL_LDAP=false
  361. RUN if [ ${INSTALL_LDAP} = true ]; then \
  362. apt-get install -y libldap2-dev && \
  363. docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ && \
  364. docker-php-ext-install ldap \
  365. ;fi
  366. ###########################################################################
  367. # SQL SERVER:
  368. ###########################################################################
  369. ARG INSTALL_MSSQL=false
  370. RUN set -eux; \
  371. if [ ${INSTALL_MSSQL} = true ]; then \
  372. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  373. apt-get -y install freetds-dev libsybdb5 \
  374. && ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/libsybdb.so \
  375. && docker-php-ext-install mssql pdo_dblib \
  376. && php -m | grep -q 'mssql' \
  377. && php -m | grep -q 'pdo_dblib' \
  378. ;else \
  379. ###########################################################################
  380. # Ref from https://github.com/Microsoft/msphpsql/wiki/Dockerfile-for-adding-pdo_sqlsrv-and-sqlsrv-to-official-php-image
  381. ###########################################################################
  382. # Add Microsoft repo for Microsoft ODBC Driver 13 for Linux
  383. apt-get install -y apt-transport-https gnupg \
  384. && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
  385. && curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \
  386. && apt-get update -yqq \
  387. # Install Dependencies
  388. && ACCEPT_EULA=Y apt-get install -y unixodbc unixodbc-dev libgss3 odbcinst msodbcsql17 locales \
  389. && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
  390. # link local aliases
  391. && ln -sfn /etc/locale.alias /usr/share/locale/locale.alias \
  392. && locale-gen \
  393. # Install pdo_sqlsrv and sqlsrv from PECL. Replace pdo_sqlsrv-4.1.8preview with preferred version.
  394. && if [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \
  395. pecl install pdo_sqlsrv-5.3.0 sqlsrv-5.3.0 \
  396. ;else \
  397. pecl install pdo_sqlsrv sqlsrv \
  398. ;fi \
  399. && docker-php-ext-enable pdo_sqlsrv sqlsrv \
  400. && php -m | grep -q 'pdo_sqlsrv' \
  401. && php -m | grep -q 'sqlsrv' \
  402. ;fi \
  403. ;fi
  404. ###########################################################################
  405. # Image optimizers:
  406. ###########################################################################
  407. USER root
  408. ARG INSTALL_IMAGE_OPTIMIZERS=false
  409. RUN if [ ${INSTALL_IMAGE_OPTIMIZERS} = true ]; then \
  410. apt-get install -y jpegoptim optipng pngquant gifsicle \
  411. ;fi
  412. ###########################################################################
  413. # ImageMagick:
  414. ###########################################################################
  415. USER root
  416. ARG INSTALL_IMAGEMAGICK=false
  417. RUN if [ ${INSTALL_IMAGEMAGICK} = true ]; then \
  418. apt-get install -y libmagickwand-dev imagemagick && \
  419. pecl install imagick && \
  420. docker-php-ext-enable imagick \
  421. ;fi
  422. ###########################################################################
  423. # IMAP:
  424. ###########################################################################
  425. ARG INSTALL_IMAP=false
  426. RUN if [ ${INSTALL_IMAP} = true ]; then \
  427. apt-get install -y libc-client-dev libkrb5-dev && \
  428. rm -r /var/lib/apt/lists/* && \
  429. docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \
  430. docker-php-ext-install imap \
  431. ;fi
  432. ###########################################################################
  433. # Calendar:
  434. ###########################################################################
  435. USER root
  436. ARG INSTALL_CALENDAR=false
  437. RUN if [ ${INSTALL_CALENDAR} = true ]; then \
  438. docker-php-ext-configure calendar && \
  439. docker-php-ext-install calendar \
  440. ;fi
  441. ###########################################################################
  442. # Phalcon:
  443. ###########################################################################
  444. ARG INSTALL_PHALCON=false
  445. ARG LARADOCK_PHALCON_VERSION
  446. ENV LARADOCK_PHALCON_VERSION ${LARADOCK_PHALCON_VERSION}
  447. # Copy phalcon configration
  448. COPY ./phalcon.ini /usr/local/etc/php/conf.d/phalcon.ini.disable
  449. RUN if [ $INSTALL_PHALCON = true ]; then \
  450. apt-get update && apt-get install -y unzip libpcre3-dev gcc make re2c \
  451. && curl -L -o /tmp/cphalcon.zip https://github.com/phalcon/cphalcon/archive/v${LARADOCK_PHALCON_VERSION}.zip \
  452. && unzip -d /tmp/ /tmp/cphalcon.zip \
  453. && cd /tmp/cphalcon-${LARADOCK_PHALCON_VERSION}/build \
  454. && ./install \
  455. && mv /usr/local/etc/php/conf.d/phalcon.ini.disable /usr/local/etc/php/conf.d/phalcon.ini \
  456. && rm -rf /tmp/cphalcon* \
  457. ;fi
  458. ###########################################################################
  459. # APCU:
  460. ###########################################################################
  461. ARG INSTALL_APCU=false
  462. RUN if [ ${INSTALL_APCU} = true ]; then \
  463. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  464. pecl install -a apcu-4.0.11; \
  465. else \
  466. pecl install apcu; \
  467. fi && \
  468. docker-php-ext-enable apcu \
  469. ;fi
  470. ###########################################################################
  471. # YAML:
  472. ###########################################################################
  473. USER root
  474. ARG INSTALL_YAML=false
  475. RUN if [ ${INSTALL_YAML} = true ]; then \
  476. apt-get install libyaml-dev -y ; \
  477. if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \
  478. pecl install -a yaml-1.3.2; \
  479. else \
  480. pecl install yaml; \
  481. fi && \
  482. docker-php-ext-enable yaml \
  483. ;fi
  484. ###########################################################################
  485. # Install additional locales:
  486. ###########################################################################
  487. ARG INSTALL_ADDITIONAL_LOCALES=false
  488. ARG ADDITIONAL_LOCALES
  489. RUN if [ ${INSTALL_ADDITIONAL_LOCALES} = true ]; then \
  490. apt-get install -y locales \
  491. && echo '' >> /usr/share/locale/locale.alias \
  492. && temp="${ADDITIONAL_LOCALES%\"}" \
  493. && temp="${temp#\"}" \
  494. && for i in ${temp}; do sed -i "/$i/s/^#//g" /etc/locale.gen; done \
  495. && locale-gen \
  496. ;fi
  497. ###########################################################################
  498. # MySQL Client:
  499. ###########################################################################
  500. USER root
  501. ARG INSTALL_MYSQL_CLIENT=false
  502. RUN if [ ${INSTALL_MYSQL_CLIENT} = true ]; then \
  503. apt-get update -yqq && \
  504. apt-get -y install mysql-client \
  505. ;fi
  506. ###########################################################################
  507. # Check PHP version:
  508. ###########################################################################
  509. RUN set -xe; php -v | head -n 1 | grep -q "PHP ${LARADOCK_PHP_VERSION}."
  510. #
  511. #--------------------------------------------------------------------------
  512. # Final Touch
  513. #--------------------------------------------------------------------------
  514. #
  515. COPY ./laravel.ini /usr/local/etc/php/conf.d
  516. COPY ./xlaravel.pool.conf /usr/local/etc/php-fpm.d/
  517. USER root
  518. # Clean up
  519. RUN apt-get clean && \
  520. rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
  521. rm /var/log/lastlog /var/log/faillog
  522. RUN usermod -u 1000 www-data
  523. # Adding the faketime library to the preload file needs to be done last
  524. # otherwise it will preload it for all commands that follow in this file
  525. RUN if [ ${INSTALL_FAKETIME} = true ]; then \
  526. echo "/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1" > /etc/ld.so.preload \
  527. ;fi
  528. WORKDIR /var/www
  529. CMD ["php-fpm"]
  530. EXPOSE 9000