Skip to content

Commit 91880ae

Browse files
author
Bryan Latten
authored
Merge pull request #171 from bryanlatten/feature-7.4
PHP 7.4
2 parents f45e34a + 215a6d5 commit 91880ae

15 files changed

Lines changed: 150 additions & 102 deletions

File tree

Dockerfile-70

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM behance/docker-nginx:8.5
2-
MAINTAINER Bryan Latten <latten@adobe.com>
1+
FROM behance/docker-nginx:8.7
2+
LABEL maintainers="Behance Team <dev-behance@adobe.com>"
33

44
# Set TERM to suppress warning messages.
55
ENV CONF_PHPFPM=/etc/php/7.0/fpm/php-fpm.conf \

Dockerfile-71

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM behance/docker-nginx:8.5
2-
MAINTAINER Bryan Latten <latten@adobe.com>
1+
FROM behance/docker-nginx:8.7
2+
LABEL maintainers="Behance Team <dev-behance@adobe.com>"
33

44
# Set TERM to suppress warning messages.
55
ENV CONF_PHPFPM=/etc/php/7.1/fpm/php-fpm.conf \

Dockerfile-72

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM behance/docker-nginx:8.5
2-
MAINTAINER Bryan Latten <latten@adobe.com>
1+
FROM behance/docker-nginx:8.7
2+
LABEL maintainers="Behance Team <dev-behance@adobe.com>"
33

44
# Set TERM to suppress warning messages.
55
ENV CONF_PHPFPM=/etc/php/7.2/fpm/php-fpm.conf \

Dockerfile-72-alpine

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM behance/docker-nginx:8.5-alpine
2-
MAINTAINER Bryan Latten <latten@adobe.com>
1+
FROM behance/docker-nginx:8.7-alpine
2+
LABEL maintainers="Behance Team <dev-behance@adobe.com>"
33

44
# Set TERM to suppress warning messages.
55
ENV CONF_PHPFPM=/etc/php7/php-fpm.conf \
@@ -97,7 +97,7 @@ RUN NEWRELIC_MUSL_PATH=$(curl -s https://download.newrelic.com/php_agent/release
9797
cd $NEWRELIC_DIRECTORY && \
9898
echo "\n" | ./newrelic-install install && \
9999
chown root:root $NEWRELIC_DIRECTORY/agent/x64/newrelic-20160303.so && \
100-
mv $NEWRELIC_DIRECTORY/agent/x64/newrelic-20160303.so /usr/lib/php7/modules/newrelic.so && \
100+
mv $NEWRELIC_DIRECTORY/agent/x64/newrelic-20170718.so /usr/lib/php7/modules/newrelic.so && \
101101
rm -rf $NEWRELIC_DIRECTORY/agent/x64 && \
102102
# Fix permissions on extracted folder \
103103
chown -R $NOT_ROOT_USER:$NOT_ROOT_USER * && \
@@ -138,7 +138,6 @@ COPY ./container/root /
138138
RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
139139
rm $CONF_PHPMODS/00_opcache.ini && \
140140
# - Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants
141-
touch /var/run/lock && \
142141
chown $NOT_ROOT_USER:$NOT_ROOT_USER /var/log/php7 && \
143142
ln -s /usr/sbin/php-fpm7 /usr/sbin/php-fpm && \
144143
/bin/bash -e prep-php.sh

Dockerfile-73

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM behance/docker-nginx:8.5
2-
MAINTAINER Bryan Latten <latten@adobe.com>
1+
FROM behance/docker-nginx:8.7
2+
LABEL maintainers="Behance Team <dev-behance@adobe.com>"
33

44
# Set TERM to suppress warning messages.
55
ENV CONF_PHPFPM=/etc/php/7.3/fpm/php-fpm.conf \

Dockerfile-56 renamed to Dockerfile-74

Lines changed: 66 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
FROM behance/docker-nginx:8.5
2-
MAINTAINER Bryan Latten <latten@adobe.com>
1+
FROM behance/docker-nginx:8.7
2+
LABEL maintainers="Behance Team <dev-behance@adobe.com>"
33

44
# Set TERM to suppress warning messages.
5-
ENV CONF_PHPFPM=/etc/php/5.6/fpm/php-fpm.conf \
6-
CONF_PHPMODS=/etc/php/5.6/mods-available \
7-
CONF_FPMPOOL=/etc/php/5.6/fpm/pool.d/www.conf \
8-
CONF_FPMOVERRIDES=/etc/php/5.6/fpm/conf.d/overrides.user.ini \
5+
ENV CONF_PHPFPM=/etc/php/7.4/fpm/php-fpm.conf \
6+
CONF_PHPMODS=/etc/php/7.4/mods-available \
7+
CONF_FPMPOOL=/etc/php/7.4/fpm/pool.d/www.conf \
8+
CONF_FPMOVERRIDES=/etc/php/7.4/fpm/conf.d/overrides.user.ini \
99
APP_ROOT=/app \
1010
SERVER_WORKER_CONNECTIONS=3072 \
1111
SERVER_CLIENT_BODY_BUFFER_SIZE=128k \
@@ -51,10 +51,17 @@ RUN /bin/bash -e /security_updates.sh && \
5151
&& \
5252
/bin/bash /clean.sh
5353

54-
# Add PHP and support packages \
54+
# Add PHP and support packages
55+
COPY container/root/usr/local/bin/pecl-install /usr/local/bin
5556
RUN apt-get update -q && \
56-
# Ensure PHP 5.5 + 7.0 + 7.1 don't accidentally get added by PPA
57+
# Ensure old versions of PHP don't accidentally get added by PPA maintainers
5758
apt-mark hold \
59+
apache2 \
60+
apache2-bin \
61+
libapache2-mod-php7.4 \
62+
php5.6-cli \
63+
php5.6-common \
64+
php5.6-json \
5865
php7.0-cli \
5966
php7.0-common \
6067
php7.0-json \
@@ -69,65 +76,84 @@ RUN apt-get update -q && \
6976
php7.3-json \
7077
&& \
7178
apt-get -yqq install \
72-
php5.6 \
73-
php5.6-apcu \
74-
php5.6-bcmath \
75-
php5.6-bz2 \
76-
php5.6-curl \
77-
php5.6-dev \
78-
php5.6-fpm \
79-
php5.6-gd \
80-
php5.6-igbinary \
81-
php5.6-intl \
82-
php5.6-json \
83-
php5.6-mbstring \
84-
php5.6-mcrypt \
85-
php5.6-mysql \
86-
php5.6-pgsql \
87-
php5.6-memcache \
88-
php5.6-memcached \
89-
php5.6-xdebug \
90-
php5.6-xml \
91-
php5.6-yaml \
92-
php5.6-zip \
79+
php7.4 \
80+
php7.4-bcmath \
81+
php7.4-bz2 \
82+
php7.4-curl \
83+
php7.4-dev \
84+
php7.4-fpm \
85+
php7.4-gd \
86+
php7.4-intl \
87+
php7.4-json \
88+
php7.4-mbstring \
89+
php7.4-memcache \
90+
php7.4-mysql \
91+
php7.4-pgsql \
92+
php7.4-xdebug \
93+
php7.4-xml \
94+
php7.4-zip \
9395
newrelic-php5 \
9496
newrelic-php5-common \
9597
newrelic-daemon \
98+
# Temporary tweaks to support 7.4-beta
99+
libmemcached-dev \
100+
pkg-config \
101+
zlib1g-dev \
102+
libyaml-dev \
96103
&& \
97104
phpdismod pdo_pgsql && \
98105
phpdismod pgsql && \
99-
phpdismod yaml && \
100106
phpdismod xdebug && \
101107
# Remove extra extensions installed via packages for other versions of PHP, leaving the active engine folder
102108
rm -rf /usr/lib/php/20121212 && \
109+
rm -rf /usr/lib/php/20131226 && \
103110
rm -rf /usr/lib/php/20151012 && \
104111
rm -rf /usr/lib/php/20160303 && \
105112
rm -rf /usr/lib/php/20170718 && \
113+
rm -rf /usr/lib/php/20180731 && \
114+
rm -rf /usr/lib/php/7.3 && \
106115
curl -sS https://getcomposer.org/installer | php && \
107116
mv composer.phar /usr/local/bin/composer && \
108-
# Install new PHP5-stable version of Redis \
109-
pecl install redis-4.2.0 && \
110-
echo "extension=redis.so" > $CONF_PHPMODS/redis.ini && \
117+
# Install new stable versions of non-packages extensions
118+
pecl-install \
119+
apcu \
120+
igbinary \
121+
redis \
122+
# memcache \
123+
memcached \
124+
msgpack \
125+
yaml \
126+
&& \
127+
phpenmod apcu igbinary memcached msgpack && \
111128
# Remove dev packages that were only in place just to compile extensions
112129
apt-get remove --purge -yq \
113-
php5.6-dev \
130+
php7.4-dev \
131+
build-essential \
132+
cpp \
133+
cpp-7 \
134+
gcc \
114135
&& \
115136
/bin/bash /clean.sh
116137

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

120-
# - Make additional hacks to migrate files/config from 7.0 --> 5.6 folder
141+
# - Make additional hacks to migrate files/config from 7.0 --> 7.4 folder
121142
RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
122143
cp /etc/php/7.0/fpm/conf.d/overrides.user.ini $CONF_FPMOVERRIDES && \
123-
# - Hack: share startup scripts between variant versions by symlinking
124-
ln -s /usr/sbin/php-fpm5.6 /usr/sbin/php-fpm && \
144+
# Hack: share startup scripts between variant versions by symlinking \
145+
ln -s /usr/sbin/php-fpm7.4 /usr/sbin/php-fpm && \
125146
# Override default ini values for both CLI + FPM \
126147
phpenmod overrides && \
127148
# Enable NewRelic via Ubuntu symlinks, but disable in file. Cross-variant startup script uncomments with env vars.
128149
phpenmod newrelic && \
129-
# - Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants \
130-
/bin/bash -e /prep-php.sh
150+
# Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants
151+
/bin/bash -e /prep-php.sh && \
152+
# New 7.3+ specific configuration
153+
sed -i "s/;decorate_workers_output.*/decorate_workers_output = no/" $CONF_FPMPOOL
131154

132-
RUN goss -g /tests/php-fpm/5.6.goss.yaml validate && \
155+
# HACK: workaround for https://github.com/aelsabbahy/goss/issues/392
156+
# Run the child and parent test configs separately instead of leveraging inheritance
157+
RUN goss -g /tests/php-fpm/7.4.goss.yaml validate && \
158+
goss -g /tests/php-fpm/base.goss.yaml validate && \
133159
/aufs_hack.sh

container/root/prep-php.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ sed -i "s/^;rlimit_files =.*/rlimit_files = 40000/" $CONF_FPMPOOL
4545
# - Set max core size rlimit for the master process.
4646
sed -i "s/^;rlimit_core =.*/rlimit_core = unlimited/" $CONF_FPMPOOL
4747

48-
# Enable NewRelic via Ubuntu symlinks, but disable in file. Cross-variant startup script uncomments with env vars.
49-
sed -i 's/extension\s\?=/;extension =/' $CONF_PHPMODS/newrelic.ini && \
50-
5148
# - Allow NewRelic to be partially configured by environment variables, set sane defaults
49+
50+
# Enable NewRelic via Ubuntu symlinks, but disable in file. Cross-variant startup script uncomments with env vars.
51+
sed -i 's/extension\s\?=/;extension =/' $CONF_PHPMODS/newrelic.ini
5252
sed -i "s/newrelic.appname = .*/newrelic.appname = \"\${REPLACE_NEWRELIC_APP}\"/" $CONF_PHPMODS/newrelic.ini
5353
sed -i "s/newrelic.license = .*/newrelic.license = \"\${REPLACE_NEWRELIC_LICENSE}\"/" $CONF_PHPMODS/newrelic.ini
5454
sed -i "s/newrelic.logfile = .*/newrelic.logfile = \"\/dev\/stdout\"/" $CONF_PHPMODS/newrelic.ini
@@ -60,5 +60,9 @@ sed -i "s/;newrelic.daemon.loglevel = .*/newrelic.daemon.loglevel = \"warning\"/
6060
sed -i "s/listen [0-9]*;/listen ${CONTAINER_PORT};/" $CONF_NGINX_SITE
6161

6262
# - Required for php-fpm to place .sock file into, fails otherwise
63-
mkdir /var/run/php/ && \
63+
mkdir -p /var/run/php/
64+
mkdir -p /var/run/lock/
65+
mkdir -p /var/log/newrelic/
66+
mkdir -p /run/php/
67+
6468
chown -R $NOT_ROOT_USER:$NOT_ROOT_USER /var/run/php /var/run/lock /var/log/newrelic

container/root/tests/php-fpm/5.6.goss.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

container/root/tests/php-fpm/7.3.goss.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ command:
1414
php -r 'echo PHP_MINOR_VERSION;':
1515
exit-status: 0
1616
stdout: [3]
17-
php-fpm7.3 -v:
17+
php-fpm -v:
1818
exit-status: 0
1919
stdout: [PHP 7.3]
2020
# Not common to all variants, test in supported children
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
# Extended file tests will be overridden/ignored from parent
3+
# Note: Other variants may not include extended file tests, are not susceptible
4+
# @see https://github.com/aelsabbahy/goss/issues/392
5+
6+
# gossfile:
7+
# base.goss.yaml: {}
8+
9+
command:
10+
# IMPORTANT: confirm the major/minor version of PHP itself
11+
php -r 'echo PHP_MAJOR_VERSION;':
12+
exit-status: 0
13+
stdout: [7]
14+
php -r 'echo PHP_MINOR_VERSION;':
15+
exit-status: 0
16+
stdout: [4]
17+
php-fpm -v:
18+
exit-status: 0
19+
stdout: [PHP 7.4]
20+
# Not common to all variants, test in supported children
21+
php -m | grep -i memcache:
22+
exit-status: 0
23+
24+
# Using workaround commands until https://github.com/aelsabbahy/goss/issues/392 is solved
25+
file:
26+
{{ .Env.CONF_FPMPOOL }}:
27+
exists: true
28+
contains:
29+
- '/^decorate_workers_output = no/'

0 commit comments

Comments
 (0)