Skip to content

Commit

Permalink
Dockerfile: updated Alpine to PHP 7.1
Browse files Browse the repository at this point in the history
- removed extra .so files installed via package in Ubuntu
- cleaned up after integration test
  • Loading branch information
Bryan Latten committed Jul 26, 2017
1 parent d6e1b37 commit 991c041
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 13 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.git/*
tmp.txt
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ RUN apt-get update -q && \
phpdismod pdo_pgsql && \
phpdismod pgsql && \
phpdismod xdebug && \
# Remove extra extensions installed via packages for other versions of PHP, leaving the active engine folder
rm -rf /usr/lib/php/20121212 && \
rm -rf /usr/lib/php/20131226 && \
# rm -rf /usr/lib/php/20151012 && \
rm -rf /usr/lib/php/20160303 && \

curl -sS https://getcomposer.org/installer | php && \
mv composer.phar /usr/local/bin/composer && \
# Install new PHP7-stable version of Yaml \
Expand All @@ -103,6 +109,7 @@ RUN apt-get update -q && \
apt-get remove --purge -yq \
php7.0-dev \
&& \

/bin/bash /clean.sh

# Overlay the root filesystem from this repo
Expand Down
15 changes: 7 additions & 8 deletions Dockerfile-alpine
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM behance/docker-nginx:8.0.0-alpine
FROM behance/docker-nginx:8.0-alpine
MAINTAINER Bryan Latten <[email protected]>

# Set TERM to suppress warning messages.
Expand Down Expand Up @@ -62,6 +62,7 @@ RUN apk update && \
php7-phar \
php7-posix \
php7-session \
php7-simplexml \
php7-sockets \
php7-sysvmsg \
php7-sysvsem \
Expand All @@ -70,18 +71,16 @@ RUN apk update && \
php7-xdebug \
php7-xml \
php7-xmlreader \
php7-xmlwriter \
php7-xsl \
php7-zip \
php7-zlib \
&& \
# Alpine + Ubuntu use different versioned names --> now standardized \
ln -s /usr/bin/php7 /usr/bin/php && \
ln -s /usr/sbin/php-fpm7 /usr/sbin/php-fpm7.0 && \
# Disable xdebug by default \
sed -i 's/zend_extension\s\?=/;zend_extension =/' $CONF_PHPMODS/xdebug.ini && \
# Disable postgres by default \
sed -i 's/extension\s\?=/;extension =/' $CONF_PHPMODS/00_pdo_pgsql.ini && \
sed -i 's/extension\s\?=/;extension =/' $CONF_PHPMODS/00_pgsql.ini && \
sed -i 's/extension/;extension/' $CONF_PHPMODS/01_pdo_pgsql.ini && \
sed -i 's/extension/;extension/' $CONF_PHPMODS/00_pgsql.ini && \
/bin/bash -e /clean.sh

# Locate and install latest Alpine-compatible NewRelic, seed with variables to be replaced
Expand All @@ -95,8 +94,8 @@ RUN NEWRELIC_MUSL_PATH=$(curl -s https://download.newrelic.com/php_agent/release
NEWRELIC_DIRECTORY=/root/$(basename $(find . -maxdepth 1 -type d -name newrelic\*)) && \
cd $NEWRELIC_DIRECTORY && \
echo "\n" | ./newrelic-install install && \
chown root:root $NEWRELIC_DIRECTORY/agent/x64/newrelic-20151012.so && \
mv $NEWRELIC_DIRECTORY/agent/x64/newrelic-20151012.so /usr/lib/php7/modules/newrelic.so && \
chown root:root $NEWRELIC_DIRECTORY/agent/x64/newrelic-20160303.so && \
mv $NEWRELIC_DIRECTORY/agent/x64/newrelic-20160303.so /usr/lib/php7/modules/newrelic.so && \
rm -rf $NEWRELIC_DIRECTORY/agent/x64 && \
# Fix permissions on extracted folder \
chown -R $NOT_ROOT_USER:$NOT_ROOT_USER * && \
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile-edge
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ RUN apt-get update -q && \
phpdismod pdo_pgsql && \
phpdismod pgsql && \
phpdismod xdebug && \
# Remove extra extensions installed via packages for other versions of PHP, leaving the active engine folder
rm -rf /usr/lib/php/20121212 && \
rm -rf /usr/lib/php/20131226 && \
rm -rf /usr/lib/php/20151012 && \
# rm -rf /usr/lib/php/20160303 && \
curl -sS https://getcomposer.org/installer | php && \
mv composer.phar /usr/local/bin/composer && \
# Install new PHP 7.1-stable version of Yaml \
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile-legacy
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ RUN apt-get update -q && \
phpdismod pdo_pgsql && \
phpdismod pgsql && \
phpdismod xdebug && \
# Remove extra extensions installed via packages for other versions of PHP, leaving the active engine folder
rm -rf /usr/lib/php/20121212 && \
# rm -rf /usr/lib/php/20131226 && \
rm -rf /usr/lib/php/20151012 && \
rm -rf /usr/lib/php/20160303 && \
curl -sS https://getcomposer.org/installer | php && \
mv composer.phar /usr/local/bin/composer && \
# Install new PHP5-stable version of Yaml
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Add’s PHP-FPM, mods, and specific backend configuration to Behance’s [docker

Three variants are available:
- (default) Ubuntu-based, PHP 7.0
- (slim) Alpine-based, PHP 7.0, tagged as `-alpine`
- (slim) Alpine-based, PHP 7.1, tagged as `-alpine`
- (edge) Ubuntu-based, PHP 7.1, tagged as `-edge`
- (legacy) Ubuntu-based, PHP 5.6, tagged as `-legacy`

Expand Down
8 changes: 4 additions & 4 deletions container/root/tests/php-fpm/alpine.goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ command:
stderr: ['!/./']
php -r 'echo PHP_MINOR_VERSION;':
exit-status: 0
stdout: [0]
stdout: [1]
stderr: ['!/./']
php-fpm7.0 -m:
php-fpm7 -m:
exit-status: 0
stderr: ['!/./']
php-fpm7.0 -v:
php-fpm7 -v:
exit-status: 0
stdout: [PHP 7.0]
stdout: [PHP 7.1]
stderr: ['!/./']

package:
Expand Down
2 changes: 2 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ curl --form [email protected] $MACHINE:8080 | grep "PHP Version 7.0." > /dev/null
curl --form [email protected] $MACHINE:8081 | grep "PHP Version 7.0." > /dev/null
curl --form [email protected] $MACHINE:8082 | grep "PHP Version 7.1." > /dev/null
curl --form [email protected] $MACHINE:8083 | grep "PHP Version 5.6." > /dev/null

rm tmp.txt

0 comments on commit 991c041

Please sign in to comment.