Skip to content

Commit 5612874

Browse files
authored
Merge pull request laradock#187 from LaraDock/faster-builds
Faster builds
2 parents b1ec5b8 + 10af217 commit 5612874

4 files changed

Lines changed: 99 additions & 192 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ By default **PHP-FPM 7.0** is running.
703703

704704
2 - Search for `Dockerfile-70` in the PHP container section.
705705

706-
3 - Change the version number, by replacing `Dockerfile-70` with `Dockerfile-5`, like this:
706+
3 - Change the version number, by replacing `Dockerfile-70` with `Dockerfile-56`, like this:
707707

708708
```txt
709709
php-fpm:
@@ -722,16 +722,16 @@ docker-compose build php
722722

723723
1 - Follow the steps of (Switch from PHP `7.0` to PHP `5.6`) except the last one "rebuilding container".
724724

725-
2 - Open the `docker-compose.yml` again and make sure you are using `Dockerfile-5` like this:
725+
2 - Open the `docker-compose.yml` again and make sure you are using `Dockerfile-56` like this:
726726

727727
```txt
728728
php-fpm:
729729
build:
730730
context: ./php-fpm
731-
dockerfile: Dockerfile-5
731+
dockerfile: Dockerfile-56
732732
```
733733

734-
3 - Open `php-fpm/Dockerfile-5` file and on the first line replace the PHP version from (`FROM php:5.6-fpm`) to (`FROM php:5.5-fpm`).
734+
3 - Open `php-fpm/Dockerfile-56` file and on the first line replace the PHP version from (`FROM php:5.6-fpm`) to (`FROM php:5.5-fpm`).
735735

736736
4 - Now you can rebuild the container
737737

Lines changed: 28 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,44 @@
44
#--------------------------------------------------------------------------
55
#
66

7-
FROM php:5.6-fpm
7+
FROM laradock/php-fpm:5.6--1.0
88

99
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
1010

11-
ADD ./laravel.ini /usr/local/etc/php/conf.d
12-
ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/
13-
1411
#
1512
#--------------------------------------------------------------------------
16-
# Software's Installation
13+
# Mandatory Software's Installation
1714
#--------------------------------------------------------------------------
1815
#
19-
# Installing tools and PHP extentions using "apt", "docker-php", "pecl",
16+
# Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
17+
# are installed on the base image 'laradock/php-fpm' image. If you want
18+
# to add more Software's or remove existing one, you need to edit the
19+
# base image (https://github.com/LaraDock/php-fpm).
2020
#
2121

22-
# Install "curl", "libmemcached-dev", "libpq-dev", "libjpeg-dev",
23-
# "libpng12-dev", "libfreetype6-dev", "libssl-dev", "libmcrypt-dev",
24-
RUN apt-get update && \
25-
apt-get install -y --no-install-recommends \
26-
curl \
27-
libmemcached-dev \
28-
libz-dev \
29-
libpq-dev \
30-
libjpeg-dev \
31-
libpng12-dev \
32-
libfreetype6-dev \
33-
libssl-dev \
34-
libmcrypt-dev
35-
36-
# Install the PHP mcrypt extention
37-
RUN docker-php-ext-install mcrypt
38-
39-
# Install the PHP pdo_mysql extention
40-
RUN docker-php-ext-install pdo_mysql
41-
42-
# Install the PHP pdo_pgsql extention
43-
RUN docker-php-ext-install pdo_pgsql
22+
#
23+
#--------------------------------------------------------------------------
24+
# Optional Software's Installation
25+
#--------------------------------------------------------------------------
26+
#
27+
# Optional Software's will only be installed if you set them to `true`
28+
# in the `docker-compose.yml` before the build.
29+
#
30+
# - INSTALL_XDEBUG= false
31+
# - INSTALL_MONGO= false
32+
#
4433

4534
#####################################
46-
# gd:
35+
# xDebug:
4736
#####################################
4837

49-
# Install the PHP gd library
50-
RUN docker-php-ext-install gd && \
51-
docker-php-ext-configure gd \
52-
--enable-gd-native-ttf \
53-
--with-jpeg-dir=/usr/lib \
54-
--with-freetype-dir=/usr/include/freetype2
38+
ARG INSTALL_XDEBUG=true
39+
ENV INSTALL_XDEBUG ${INSTALL_XDEBUG}
40+
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
41+
# Install the xdebug extention
42+
pecl install xdebug && \
43+
docker-php-ext-enable xdebug \
44+
;fi
5545

5646
#####################################
5747
# MongoDB:
@@ -64,25 +54,15 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \
6454
pecl install mongodb \
6555
;fi
6656

67-
#####################################
68-
# xDebug:
69-
#####################################
70-
71-
ARG INSTALL_XDEBUG=true
72-
ENV INSTALL_XDEBUG ${INSTALL_XDEBUG}
73-
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
74-
# Install the xdebug extention
75-
pecl install xdebug && \
76-
docker-php-ext-enable xdebug \
77-
;fi
78-
79-
8057
#
8158
#--------------------------------------------------------------------------
8259
# Final Touch
8360
#--------------------------------------------------------------------------
8461
#
8562

63+
ADD ./laravel.ini /usr/local/etc/php/conf.d
64+
ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/
65+
8666
RUN rm -r /var/lib/apt/lists/*
8767

8868
RUN usermod -u 1000 www-data

php-fpm/Dockerfile-70

Lines changed: 27 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -4,65 +4,32 @@
44
#--------------------------------------------------------------------------
55
#
66

7-
FROM php:7.0-fpm
7+
FROM laradock/php-fpm:7.0--1.0
88

99
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
1010

11-
ADD ./laravel.ini /usr/local/etc/php/conf.d
12-
ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/
13-
1411
#
1512
#--------------------------------------------------------------------------
16-
# Software's Installation
13+
# Mandatory Software's Installation
1714
#--------------------------------------------------------------------------
1815
#
19-
# Installing tools and PHP extentions using "apt", "docker-php", "pecl",
16+
# Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....)
17+
# are installed on the base image 'laradock/php-fpm' image. If you want
18+
# to add more Software's or remove existing one, you need to edit the
19+
# base image (https://github.com/LaraDock/php-fpm).
2020
#
2121

22-
# Install "curl", "libmemcached-dev", "libpq-dev", "libjpeg-dev",
23-
# "libpng12-dev", "libfreetype6-dev", "libssl-dev", "libmcrypt-dev",
24-
RUN apt-get update && \
25-
apt-get install -y --no-install-recommends \
26-
curl \
27-
libmemcached-dev \
28-
libz-dev \
29-
libpq-dev \
30-
libjpeg-dev \
31-
libpng12-dev \
32-
libfreetype6-dev \
33-
libssl-dev \
34-
libmcrypt-dev
35-
36-
# Install the PHP mcrypt extention
37-
RUN docker-php-ext-install mcrypt
38-
39-
# Install the PHP pdo_mysql extention
40-
RUN docker-php-ext-install pdo_mysql
41-
42-
# Install the PHP pdo_pgsql extention
43-
RUN docker-php-ext-install pdo_pgsql
44-
45-
#####################################
46-
# gd:
47-
#####################################
48-
49-
# Install the PHP gd library
50-
RUN docker-php-ext-install gd && \
51-
docker-php-ext-configure gd \
52-
--enable-gd-native-ttf \
53-
--with-jpeg-dir=/usr/lib \
54-
--with-freetype-dir=/usr/include/freetype2
55-
56-
#####################################
57-
# MongoDB:
58-
#####################################
59-
60-
ARG INSTALL_MONGO=true
61-
ENV INSTALL_MONGO ${INSTALL_MONGO}
62-
RUN if [ ${INSTALL_MONGO} = true ]; then \
63-
# Install the mongodb extention
64-
pecl install mongodb \
65-
;fi
22+
#
23+
#--------------------------------------------------------------------------
24+
# Optional Software's Installation
25+
#--------------------------------------------------------------------------
26+
#
27+
# Optional Software's will only be installed if you set them to `true`
28+
# in the `docker-compose.yml` before the build.
29+
#
30+
# - INSTALL_XDEBUG= false
31+
# - INSTALL_MONGO= false
32+
#
6633

6734
#####################################
6835
# xDebug:
@@ -77,30 +44,25 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
7744
;fi
7845

7946
#####################################
80-
# Memcached:
47+
# MongoDB:
8148
#####################################
8249

83-
# Install the memcached extention
84-
RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \
85-
&& mkdir -p memcached \
86-
&& tar -C memcached -zxvf /tmp/memcached.tar.gz --strip 1 \
87-
&& ( \
88-
cd memcached \
89-
&& phpize \
90-
&& ./configure \
91-
&& make -j$(nproc) \
92-
&& make install \
93-
) \
94-
&& rm -r memcached \
95-
&& rm /tmp/memcached.tar.gz \
96-
&& docker-php-ext-enable memcached
50+
ARG INSTALL_MONGO=true
51+
ENV INSTALL_MONGO ${INSTALL_MONGO}
52+
RUN if [ ${INSTALL_MONGO} = true ]; then \
53+
# Install the mongodb extention
54+
pecl install mongodb \
55+
;fi
9756

9857
#
9958
#--------------------------------------------------------------------------
10059
# Final Touch
10160
#--------------------------------------------------------------------------
10261
#
10362

63+
ADD ./laravel.ini /usr/local/etc/php/conf.d
64+
ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/
65+
10466
RUN rm -r /var/lib/apt/lists/*
10567

10668
RUN usermod -u 1000 www-data

0 commit comments

Comments
 (0)