Skip to content

Commit c9df64b

Browse files
authored
Improve phpfpm image
- Add ssh client, fixes issue when some package git cloned via ssh - Reduced one layer for libsodium, less layers - smaller size - faster image - Removed not needed rm -rf /var/lib/apt/lists/* - Install composer with signature verification https://getcomposer.org/doc/faqs/how-to-install-composer-programmatically.md
1 parent a08537b commit c9df64b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

php/7.1-fpm/Dockerfile

+10-5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1818
procps \
1919
sudo \
2020
libsodium-dev \
21+
openssh-client \
2122
&& rm -rf /var/lib/apt/lists/*
2223

2324
RUN docker-php-ext-configure \
@@ -48,17 +49,21 @@ RUN rm -f /usr/local/etc/php/conf.d/*sodium.ini \
4849
&& make install \
4950
&& cd / \
5051
&& rm -rf /tmp/libsodium \
51-
&& pecl install -o -f libsodium
52-
53-
RUN docker-php-ext-enable sodium
52+
&& pecl install -o -f libsodium \
53+
&& docker-php-ext-enable sodium
5454

5555
RUN pecl channel-update pecl.php.net \
5656
&& pecl install xdebug \
5757
&& docker-php-ext-enable xdebug \
5858
&& sed -i -e 's/^zend_extension/\;zend_extension/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
5959

60-
RUN curl -sS https://getcomposer.org/installer | \
61-
php -- --install-dir=/usr/local/bin --filename=composer
60+
# install composer
61+
RUN EXPECTED_SIGNATURE="$(curl -s https://composer.github.io/installer.sig)" \
62+
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
63+
&& ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" \
64+
&& ( if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then >&2 echo 'ERROR: Invalid installer signature'; rm composer-setup.php; exit 1; fi ) \
65+
&& php composer-setup.php --install-dir /usr/local/bin --filename=composer \
66+
&& php -r "unlink('composer-setup.php');"
6267

6368
RUN groupadd -g 1000 app \
6469
&& useradd -g 1000 -u 1000 -d /var/www -s /bin/bash app

0 commit comments

Comments
 (0)