Skip to content

Commit

Permalink
Merge pull request #166 from bryanlatten/feature-nginx-upgrade
Browse files Browse the repository at this point in the history
Upgrade base / Refactor tests
  • Loading branch information
bossjones authored Apr 17, 2019
2 parents 2683959 + f8802a3 commit dda5637
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 896 deletions.
2 changes: 1 addition & 1 deletion Dockerfile-56
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM behance/docker-nginx:8.2
FROM behance/docker-nginx:8.3
MAINTAINER Bryan Latten <[email protected]>

# Set TERM to suppress warning messages.
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-70
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM behance/docker-nginx:8.2
FROM behance/docker-nginx:8.3
MAINTAINER Bryan Latten <[email protected]>

# Set TERM to suppress warning messages.
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-71
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM behance/docker-nginx:8.2
FROM behance/docker-nginx:8.3
MAINTAINER Bryan Latten <[email protected]>

# Set TERM to suppress warning messages.
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-72
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM behance/docker-nginx:8.2
FROM behance/docker-nginx:8.3
MAINTAINER Bryan Latten <[email protected]>

# Set TERM to suppress warning messages.
Expand Down
34 changes: 17 additions & 17 deletions Dockerfile-72-alpine
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM behance/docker-nginx:8.2-alpine
FROM behance/docker-nginx:8.3-alpine
MAINTAINER Bryan Latten <[email protected]>

# Set TERM to suppress warning messages.
Expand Down Expand Up @@ -106,18 +106,6 @@ RUN NEWRELIC_MUSL_PATH=$(curl -s https://download.newrelic.com/php_agent/release
RUN curl -sS https://getcomposer.org/installer | php && \
mv composer.phar /usr/local/bin/composer

# Overlay the root filesystem from this repo
COPY ./container/root /

# - Make additional hacks to migrate files from Ubuntu to Alpine folder structure
RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
rm $CONF_PHPMODS/00_opcache.ini && \
# - Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants
touch /var/run/lock && \
chown $NOT_ROOT_USER:$NOT_ROOT_USER /var/log/php7 && \
ln -s /usr/sbin/php-fpm7 /usr/sbin/php-fpm && \
/bin/bash -e prep-php.sh

RUN apk update && \
apk add --no-cache \
yaml-dev \
Expand All @@ -129,19 +117,31 @@ RUN apk update && \
autoconf file g++ gcc libc-dev make pkgconf re2c php7-dev php7-pear \
&& \
sed -i 's/^exec $PHP -C -n/exec $PHP -C/g' $(which pecl) && \
pecl install igbinary-2.0.7 && \
pecl install igbinary-3.0.1 && \
echo "extension=igbinary.so" > $CONF_PHPMODS/igbinary.ini && \
pecl install yaml-2.0.2 && \
pecl install yaml-2.0.4 && \
echo ";extension=yaml.so" > $CONF_PHPMODS/yaml.ini && \
pecl install redis-4.2.0 && \
echo ";extension=redis.so" > $CONF_PHPMODS/redis.ini && \
pecl install msgpack-2.0.2 && \
pecl install msgpack-2.0.3 && \
echo "extension=msgpack.so" > $CONF_PHPMODS/msgpack.ini && \
pecl install memcached-3.0.4 && \
pecl install memcached-3.1.3 && \
echo "extension=memcached.so" > $CONF_PHPMODS/memcached.ini && \
rm -rf /usr/share/php7 && \
apk del .phpize_deps && \
/bin/bash -e /clean.sh

# Overlay the root filesystem from this repo
COPY ./container/root /

# - Make additional hacks to migrate files from Ubuntu to Alpine folder structure
RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
rm $CONF_PHPMODS/00_opcache.ini && \
# - Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants
touch /var/run/lock && \
chown $NOT_ROOT_USER:$NOT_ROOT_USER /var/log/php7 && \
ln -s /usr/sbin/php-fpm7 /usr/sbin/php-fpm && \
/bin/bash -e prep-php.sh

RUN goss -g /tests/php-fpm/7.2-alpine.goss.yaml validate && \
/aufs_hack.sh
2 changes: 1 addition & 1 deletion Dockerfile-73
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM behance/docker-nginx:8.2
FROM behance/docker-nginx:8.3
MAINTAINER Bryan Latten <[email protected]>

# Set TERM to suppress warning messages.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Available on [Docker Hub](https://hub.docker.com/r/behance/docker-php/).
- `docker run behance/docker-php:5.6 "php" "-v"`
- `docker run behance/docker-php:7.0 "php" "-v"`
- `docker run behance/docker-php:7.1 "php" "-v"`
- `docker run behance/docker-php:7.1-alpine "php" "-v"`
- `docker run behance/docker-php:7.2 "php" "-v"`
- `docker run behance/docker-php:7.3-beta" "php" "-v"`
- `docker run behance/docker-php:7.2-alpine "php" "-v"`
- `docker run behance/docker-php:7.3" "php" "-v"`

Adding code to runtime, see [here](https://github.com/behance/docker-php#expectations).
PHP tuning and configuration, see [here](https://github.com/behance/docker-php#downstream-configuration).
Expand All @@ -28,7 +28,7 @@ Adding startup logic, [basic](https://github.com/behance/docker-base#startuprunt

- `PHP_MAJOR.PHP_MINOR`, required. Engine versions of PHP. ex. `docker-php:7.1`
- `(Major.Minor.Patch)`, optional. Semantically versioned container provisioning code. ex. `docker-php:7.1-12.4.0`.
- `(-variant)`, optional. Alpine variants are slim versions of the container. ex. `docker-php:7.1-alpine`. Beta versions are non-stable PHP engines. ex. `docker-php:7.3-beta`
- `(-variant)`, optional. Alpine variants are slim versions of the container. ex. `docker-php:7.1-alpine`.

### Includes
---
Expand Down
2 changes: 1 addition & 1 deletion container/root/prep-php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# runs performant, reliably, and consistent between variants
#---------------------------------------------------------------------------------

sed -i "s/error_log = .*/error_log = \/dev\/stdout/" $CONF_PHPFPM
sed -i "s/;*error_log = .*/error_log = \/dev\/stdout/" $CONF_PHPFPM

# - Configure php-fpm to use TCP rather than unix socket (for stability), fastcgi_pass is also set by /etc/nginx/sites-available/default
sed -i "s/listen = .*/listen = 127.0.0.1:9000/" $CONF_FPMPOOL
Expand Down
92 changes: 1 addition & 91 deletions container/root/tests/php-fpm/5.6.goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,102 +6,12 @@ command:
php -r 'echo PHP_MAJOR_VERSION;':
exit-status: 0
stdout: [5]
stderr: ['!/./']
php -r 'echo PHP_MINOR_VERSION;':
exit-status: 0
stdout: [6]
stderr: ['!/./']
php-fpm -m:
exit-status: 0
stderr: ['!/./']
php-fpm -v:
php-fpm5.6 -v:
exit-status: 0
stdout: [PHP 5.6]
stderr: ['!/./']
# Not common to all variants, test in supported children
php -m | grep -i memcache:
exit-status: 0

package:
php5.6:
installed: true
php5.6-cli:
installed: true
php5.6-curl:
installed: true
php5.6-fpm:
installed: true
php5.6-gd:
installed: true
php5.6-intl:
installed: true
php5.6-json:
installed: true
php5.6-mbstring:
installed: true
php5.6-mcrypt:
installed: true
php5.6-mysql:
installed: true
php5.6-opcache:
installed: true
php5.6-pgsql:
installed: true
php5.6-readline:
installed: true
php5.6-xml:
installed: true
php5.6-zip:
installed: true
php-apcu:
installed: true
php-igbinary:
installed: true
php-memcache:
installed: true
php-memcached:
installed: true
php-msgpack:
installed: true
php-xdebug:
installed: true

file:
# TODO: hopefully https://github.com/aelsabbahy/goss/issues/164 allows this to be a shared test using env variables
/etc/php/5.6/fpm/pool.d/www.conf:
exists: true
contains:
- '/^listen = 127.0.0.1:9000/'
- '/^chdir = \/app/'
- '/^pm.max_children = \${PHP_FPM_MAX_CHILDREN}/'
- '/^pm.start_servers = \${PHP_FPM_START_SERVERS}/'
- '/^pm.max_requests = \${PHP_FPM_MAX_REQUESTS}/'
- '/^pm.min_spare_servers = \${PHP_FPM_MIN_SPARE_SERVERS}/'
- '/^pm.max_spare_servers = \${PHP_FPM_MAX_SPARE_SERVERS}/'
- '/^pm.status_path = \/__status/'
- '/^clear_env = no/'
- '/^catch_workers_output = yes/'
- '/^listen.allowed_clients = 127.0.0.1/'
# - '/^;user =/'
# - '/^;group =/'
- '/^request_terminate_timeout = \${PHP_FPM_MAX_EXECUTION_TIME}/'
- '/^rlimit_files = 40000/'
- '/^rlimit_core = unlimited/'
/etc/php/5.6/mods-available/newrelic.ini:
exists: true
contains:
- '/^;extension =/'
- '/^newrelic.appname = \"\${REPLACE_NEWRELIC_APP}\"/'
- '/^newrelic.license = \"\${REPLACE_NEWRELIC_LICENSE}\"/'
- '/^newrelic.logfile = \"\/dev\/stdout\"/'
- '/^newrelic.daemon.logfile = \"\/dev\/stdout\"/'
- '/^newrelic.loglevel = \"warning\"/'
- '/^newrelic.daemon.loglevel = \"warning\"/'
- '!/^newrelic.transaction_tracer.enabled = true/'
- '!/^newrelic.distributed_tracing_enabled = true/'
- '/^;newrelic.transaction_tracer.enabled = true/'
- '/^;newrelic.distributed_tracing_enabled = false/'
/etc/php/5.6/fpm/php-fpm.conf:
exists: true
contains:
- '/^error_log = \/dev\/stdout/'
92 changes: 1 addition & 91 deletions container/root/tests/php-fpm/7.0.goss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,102 +6,12 @@ command:
php -r 'echo PHP_MAJOR_VERSION;':
exit-status: 0
stdout: [7]
stderr: ['!/./']
php -r 'echo PHP_MINOR_VERSION;':
exit-status: 0
stdout: [0]
stderr: ['!/./']
php-fpm -m:
exit-status: 0
stderr: ['!/./']
php-fpm -v:
php-fpm7.0 -v:
exit-status: 0
stdout: [PHP 7.0]
stderr: ['!/./']
# Not common to all variants, test in supported children
php -m | grep -i memcache:
exit-status: 0

package:
php7.0:
installed: true
php7.0-cli:
installed: true
php7.0-curl:
installed: true
php7.0-fpm:
installed: true
php7.0-gd:
installed: true
php7.0-intl:
installed: true
php7.0-json:
installed: true
php7.0-mbstring:
installed: true
php7.0-mcrypt:
installed: true
php7.0-mysql:
installed: true
php7.0-opcache:
installed: true
php7.0-pgsql:
installed: true
php7.0-readline:
installed: true
php7.0-xml:
installed: true
php7.0-zip:
installed: true
php-apcu:
installed: true
php-igbinary:
installed: true
php-memcache:
installed: true
php-memcached:
installed: true
php-msgpack:
installed: true
php-xdebug:
installed: true

file:
# TODO: hopefully https://github.com/aelsabbahy/goss/issues/164 allows this to be a shared test using env variables
/etc/php/7.0/fpm/pool.d/www.conf:
exists: true
contains:
- '/^listen = 127.0.0.1:9000/'
- '/^chdir = \/app/'
- '/^pm.max_children = \${PHP_FPM_MAX_CHILDREN}/'
- '/^pm.start_servers = \${PHP_FPM_START_SERVERS}/'
- '/^pm.max_requests = \${PHP_FPM_MAX_REQUESTS}/'
- '/^pm.min_spare_servers = \${PHP_FPM_MIN_SPARE_SERVERS}/'
- '/^pm.max_spare_servers = \${PHP_FPM_MAX_SPARE_SERVERS}/'
- '/^pm.status_path = \/__status/'
- '/^clear_env = no/'
- '/^catch_workers_output = yes/'
- '/^listen.allowed_clients = 127.0.0.1/'
# - '/^;user =/'
# - '/^;group =/'
- '/^request_terminate_timeout = \${PHP_FPM_MAX_EXECUTION_TIME}/'
- '/^rlimit_files = 40000/'
- '/^rlimit_core = unlimited/'
/etc/php/7.0/mods-available/newrelic.ini:
exists: true
contains:
- '/^;extension =/'
- '/^newrelic.appname = \"\${REPLACE_NEWRELIC_APP}\"/'
- '/^newrelic.license = \"\${REPLACE_NEWRELIC_LICENSE}\"/'
- '/^newrelic.logfile = \"\/dev\/stdout\"/'
- '/^newrelic.daemon.logfile = \"\/dev\/stdout\"/'
- '/^newrelic.loglevel = \"warning\"/'
- '/^newrelic.daemon.loglevel = \"warning\"/'
- '!/^newrelic.transaction_tracer.enabled = true/'
- '!/^newrelic.distributed_tracing_enabled = true/'
- '/^;newrelic.transaction_tracer.enabled = true/'
- '/^;newrelic.distributed_tracing_enabled = false/'
/etc/php/7.0/fpm/php-fpm.conf:
exists: true
contains:
- '/^error_log = \/dev\/stdout/'
Loading

0 comments on commit dda5637

Please sign in to comment.