Skip to content

Commit

Permalink
Merge pull request #139 from bryanlatten/php7.2-beta
Browse files Browse the repository at this point in the history
Dockerfile: [breaking] changed tagging and versioning standard
  • Loading branch information
bryanlatten committed Aug 1, 2017
2 parents 9333619 + cd6e186 commit 3402d94
Show file tree
Hide file tree
Showing 13 changed files with 474 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Dockerfile-legacy → Dockerfile-56
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
# - Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants \
/bin/bash -e /prep-php.sh

RUN goss -g /tests/php-fpm/legacy.goss.yaml validate && \
RUN goss -g /tests/php-fpm/5.6.goss.yaml validate && \
/aufs_hack.sh
2 changes: 1 addition & 1 deletion Dockerfile → Dockerfile-70
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@ RUN ln -s /usr/sbin/php-fpm7.0 /usr/sbin/php-fpm && \
# Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants
/bin/bash -e /prep-php.sh

RUN goss -g /tests/php-fpm/ubuntu.goss.yaml validate && \
RUN goss -g /tests/php-fpm/7.0.goss.yaml validate && \
/aufs_hack.sh

4 changes: 2 additions & 2 deletions Dockerfile-edge → Dockerfile-71
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ RUN /bin/bash -e /security_updates.sh && \

# Add PHP and support packages \
RUN apt-get update -q && \
# Ensure PHP 5.5 + 5.6 + 7.1 don't accidentally get added by PPA
# Ensure PHP 5.5 + 5.6 + 7.0 don't accidentally get added by PPA
apt-mark hold \
php5.6-cli \
php5.6-common \
Expand Down Expand Up @@ -125,5 +125,5 @@ RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
# - Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants
/bin/bash -e /prep-php.sh

RUN goss -g /tests/php-fpm/edge.goss.yaml validate && \
RUN goss -g /tests/php-fpm/7.1.goss.yaml validate && \
/aufs_hack.sh
2 changes: 1 addition & 1 deletion Dockerfile-alpine → Dockerfile-71-alpine
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,5 @@ RUN apk update && \
apk del .phpize_deps && \
/bin/bash -e /clean.sh

RUN goss -g /tests/php-fpm/alpine.goss.yaml validate && \
RUN goss -g /tests/php-fpm/7.1-alpine.goss.yaml validate && \
/aufs_hack.sh
137 changes: 137 additions & 0 deletions Dockerfile-72
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
FROM behance/docker-nginx:8.0
MAINTAINER Bryan Latten <latten@adobe.com>

# Set TERM to suppress warning messages.
ENV CONF_PHPFPM=/etc/php/7.2/fpm/php-fpm.conf \
CONF_PHPMODS=/etc/php/7.2/mods-available \
CONF_FPMPOOL=/etc/php/7.2/fpm/pool.d/www.conf \
CONF_FPMOVERRIDES=/etc/php/7.2/fpm/conf.d/overrides.user.ini \
APP_ROOT=/app \
SERVER_WORKER_CONNECTIONS=3072 \
SERVER_CLIENT_BODY_BUFFER_SIZE=128k \
SERVER_CLIENT_HEADER_BUFFER_SIZE=1k \
SERVER_CLIENT_BODY_BUFFER_SIZE=128k \
SERVER_LARGE_CLIENT_HEADER_BUFFERS="4 256k" \
PHP_FPM_MAX_CHILDREN=4096 \
PHP_FPM_START_SERVERS=20 \
PHP_FPM_MAX_REQUESTS=1024 \
PHP_FPM_MIN_SPARE_SERVERS=5 \
PHP_FPM_MAX_SPARE_SERVERS=128 \
PHP_FPM_MEMORY_LIMIT=256M \
PHP_FPM_MAX_EXECUTION_TIME=60 \
PHP_FPM_UPLOAD_MAX_FILESIZE=1M \
PHP_OPCACHE_MEMORY_CONSUMPTION=128 \
PHP_OPCACHE_INTERNED_STRINGS_BUFFER=16 \
PHP_OPCACHE_MAX_WASTED_PERCENTAGE=5 \
CFG_APP_DEBUG=1

# - Update security packages, only
RUN /bin/bash -e /security_updates.sh && \
apt-get install -yqq --no-install-recommends \
git \
curl \
wget \
software-properties-common \
locales \
&& \
locale-gen en_US.UTF-8 && export LANG=en_US.UTF-8 && \
add-apt-repository ppa:git-core/ppa -y && \
add-apt-repository ppa:ondrej/php -y && \
echo 'deb http://apt.newrelic.com/debian/ newrelic non-free' | tee /etc/apt/sources.list.d/newrelic.list && \
wget -O- https://download.newrelic.com/548C16BF.gpg | apt-key add - && \
# Prevent newrelic install from prompting for input \
echo newrelic-php5 newrelic-php5/application-name string "REPLACE_NEWRELIC_APP" | debconf-set-selections && \
echo newrelic-php5 newrelic-php5/license-key string "REPLACE_NEWRELIC_LICENSE" | debconf-set-selections && \
# Perform cleanup \
apt-get remove --purge -yq \
patch \
software-properties-common \
locales \
wget \
&& \
/bin/bash /clean.sh

# Add PHP and support packages \
RUN apt-get update -q && \
# Ensure PHP 5.5 + 5.6 + 7.1 don't accidentally get added by PPA
apt-mark hold \
php5.6-cli \
php5.6-common \
php5.6-json \
php7.0-cli \
php7.0-common \
php7.0-json \
php7.1-cli \
php7.1-common \
php7.1-json

# TODO: fix these packages:
# php7.2-igbinary
# php7.2-apcu
# php7.2-mcrypt
# php7.2-gearman
# php7.2-memcache
# php7.2-memcached
# php-xdebug
# newrelic-php5
# newrelic-php5-common
# newrelic-daemon

RUN apt-get -yqq install \
php7.2 \
php7.2-bz2 \
php7.2-curl \
php7.2-dev \
php7.2-fpm \
php7.2-gd \
php7.2-intl \
php7.2-json \
php7.2-mbstring \
php7.2-mysql \
php7.2-pgsql \
php7.2-xml \
php7.2-zip \
libyaml-dev \
&& \
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.X-stable version of Yaml \
# pecl install yaml-2.0.0 && \
# echo "extension=yaml.so" > $CONF_PHPMODS/yaml.ini && \
# Install new PHP 7.X-stable version of Redis
# pecl install redis-3.1.2 && \
# echo "extension=redis.so" > $CONF_PHPMODS/redis.ini && \
# Remove dev packages that were only in place just to compile extensions
apt-get remove --purge -yq \
php7.2-dev \
&& \
/bin/bash /clean.sh

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

# - Make additional hacks to migrate files/config from 7.0 --> 7.2 folder
RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \
cp /etc/php/7.0/fpm/conf.d/overrides.user.ini $CONF_FPMOVERRIDES && \
# Hack: share startup scripts between variant versions by symlinking \
ln -s /usr/sbin/php-fpm7.2 /usr/sbin/php-fpm && \
# Override default ini values for both CLI + FPM \
phpenmod overrides && \
# Enable NewRelic via Ubuntu symlinks, but disable in file. Cross-variant startup script uncomments with env vars.
# HACK: ensure file/folders exist so prep script still runs until NewRelic extension works with PHP 7.2
touch $CONF_PHPMODS/newrelic.ini && \
mkdir /var/log/newrelic && \
# phpenmod newrelic && \
# - Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants
/bin/bash -e /prep-php.sh

RUN goss -g /tests/php-fpm/7.2.goss.yaml validate && \
/aufs_hack.sh
48 changes: 25 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,29 @@
docker-php
==========

Provides basic building blocks for PHP web applications, available on [Docker Hub](https://hub.docker.com/r/bryanlatten/docker-php/)
Provides basic building blocks for PHP web applications, available on [Docker Hub](https://hub.docker.com/r/bryanlatten/docker-php/).
Add’s PHP-FPM, mods, and specific backend configuration to Behance’s [docker-nginx](https://github.com/behance/docker-nginx)

####New naming scheme: `PHP_MAJOR.PHP_MINOR-Major.Minor.Patch(-variant)`

- `PHP_MAJOR.PHP_MINOR` are the runtime versions of PHP.
- `Major.Minor.Patch` are versions of the container provisioning software
- `(-variant)`, an optional distinction, i.e. `-alpine`. Alpine variants are slim versions of the container.

Three variants are available:
- (default) Ubuntu-based, PHP 7.0
- (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`

### Includes
---
- Nginx
- PHP/PHP-FPM (7.0, 7.1, 5.6)
- S6: for PID 1 zombie reaping, startup coordination, shutdown signal transferal
- Goss: for serverspec-like testing. Run `goss -g /tests/php-fpm/{variant_name}.goss.yaml` to validate any configuration updates
- Ubuntu or Alpine container [base](https://github.com/behance/docker-base)
- [Nginx](https://github.com/behance/docker-nginx)
- PHP / PHP-FPM: choose from 5.6, 7.0, 7.1, 7.2 (beta)
- [S6](https://github.com/just-containers/s6-overlay): PID 1 zombie reaping, startup coordination, shutdown signal transferal
- [Goss](https://goss.rocks): for serverspec-like testing. Run `goss -g /tests/php-fpm/{PHP_MAJOR.PHP_MINOR}(-variant).goss.yaml` to validate any configuration updates
- Extra PHP Modules:

`*` - not available on Alpine variant
`^` - not available on Edge variant
`~` - disabled by default (use `phpenmod` to enable on Ubuntu-based variants, uncomment .ini file otherwise)
- apc* (only visible for backwards compatibility)
`*` - not available on `-alpine` variant
`^` - not available on `7.2`
`~` - disabled by default (use `phpenmod` to enable on non-Alpine variants, uncomment .ini file otherwise)

- apcu
- calendar
- bz2
Expand All @@ -36,18 +37,19 @@ Three variants are available:
- exif
- cgi-fcgi
- gd
- gearman*
- gearman*^
- iconv
- igbinary
- igbinary^
- intl
- json
- mbstring
- mcrypt
- memcache*
- memcached
- mcrypt^
- memcache*^
- memcached^
- msgpack^
- mysqli
- mysqlnd
- newrelic~ (activates with env variables)
- newrelic~^ (activates with env variables)
- opcache
- openssl
- pcntl
Expand All @@ -57,19 +59,19 @@ Three variants are available:
- pgsql~
- phar
- posix
- redis~
- redis~^
- shmop
- SimpleXML
- sockets
- sysvmsg
- sysvsem
- sysvshm
- tokenizer
- xdebug~
- xdebug~^
- xml
- xmlreader
- xmlwriter
- yaml*~
- yaml~^
- zip
- zlib

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 3402d94

Please sign in to comment.