Skip to content

Commit c8d4461

Browse files
committed
Refactor the PHP 7 Dockerfile
1 parent 23b0906 commit c8d4461

1 file changed

Lines changed: 48 additions & 25 deletions

File tree

php-fpm/Dockerfile-70

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,60 @@
1-
FROM php:7.0-fpm
1+
#
2+
#--------------------------------------------------------------------------
3+
# Image Setup
4+
#--------------------------------------------------------------------------
5+
#
26

3-
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
7+
FROM php:7.0-fpm
48

59
ADD ./laravel.ini /usr/local/etc/php/conf.d
610
ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/
711

8-
RUN apt-get update && apt-get install -y \
9-
libpq-dev \
10-
libmemcached-dev \
12+
RUN apt-get update
13+
14+
#
15+
#--------------------------------------------------------------------------
16+
# Software's Installation
17+
#--------------------------------------------------------------------------
18+
#
19+
# Installing tools and PHP extentions using "apt", "docker-php", "pecl",
20+
#
21+
22+
# Install "curl", "libmemcached-dev", "libpq-dev", "libjpeg-dev",
23+
# "libpng12-dev", "libfreetype6-dev", "libssl-dev", "libmcrypt-dev",
24+
RUN apt-get install -y --no-install-recommends \
1125
curl \
26+
libmemcached-dev \
27+
libpq-dev \
1228
libjpeg-dev \
1329
libpng12-dev \
1430
libfreetype6-dev \
1531
libssl-dev \
16-
libmcrypt-dev \
17-
--no-install-recommends \
18-
&& rm -r /var/lib/apt/lists/*
32+
libmcrypt-dev
1933

20-
# install mcrypt library
34+
# Install the PHP mcrypt extention
2135
RUN docker-php-ext-install mcrypt
2236

23-
# Install mongodb driver
24-
RUN pecl install mongodb
37+
# Install the PHP pdo_mysql extention
38+
RUN docker-php-ext-install pdo_mysql
2539

26-
# configure gd library
27-
RUN docker-php-ext-configure gd \
28-
--enable-gd-native-ttf \
29-
--with-jpeg-dir=/usr/lib \
30-
--with-freetype-dir=/usr/include/freetype2
40+
# Install the PHP pdo_pgsql extention
41+
RUN docker-php-ext-install pdo_pgsql
3142

32-
# Install extensions using the helper script provided by the base image
33-
RUN docker-php-ext-install \
34-
pdo_mysql \
35-
pdo_pgsql \
36-
gd
43+
# Install the PHP gd library
44+
RUN docker-php-ext-install gd \
45+
&& docker-php-ext-configure gd \
46+
--enable-gd-native-ttf \
47+
--with-jpeg-dir=/usr/lib \
48+
--with-freetype-dir=/usr/include/freetype2
3749

38-
# Install Memcached for php 7
50+
# Install the mongodb extention
51+
RUN pecl install mongodb
52+
53+
# Install the xdebug extention
54+
RUN pecl install xdebug \
55+
&& docker-php-ext-enable xdebug
56+
57+
# Install the memcached extention
3958
RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \
4059
&& mkdir -p memcached \
4160
&& tar -C memcached -zxvf /tmp/memcached.tar.gz --strip 1 \
@@ -50,9 +69,13 @@ RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-m
5069
&& rm /tmp/memcached.tar.gz \
5170
&& docker-php-ext-enable memcached
5271

53-
# Install xdebug
54-
RUN pecl install xdebug \
55-
&& docker-php-ext-enable xdebug
72+
#
73+
#--------------------------------------------------------------------------
74+
# Final Touch
75+
#--------------------------------------------------------------------------
76+
#
77+
78+
RUN rm -r /var/lib/apt/lists/*
5679

5780
RUN usermod -u 1000 www-data
5881

0 commit comments

Comments
 (0)