Skip to content
Permalink
Browse files

Add PHP 7.3 preview (w/o memcached) (ezsystems#32)

Add PHP 7.3 preview (xdebug in rc version)
  • Loading branch information...
andrerom committed Feb 13, 2019
1 parent a00f8cb commit 22cd9e89b38e78c76af48250fd09f7141ba4d48d
Showing with 136 additions and 23 deletions.
  1. +1 −0 .travis.yml
  2. +10 −9 README.md
  3. +0 −14 bin/.travis/test.sh
  4. +125 −0 php/Dockerfile-7.3
@@ -17,6 +17,7 @@ env:
- PHP_VERSION="7.0" EZ_VERSION="^1.13.4"
- PHP_VERSION="7.1"
- PHP_VERSION="7.2"
- PHP_VERSION="7.3" XDEBUG_CHANNEL="xdebug-beta"

before_script:
- if [ ! -d ~/.composer/ ] ; then mkdir ~/.composer/; fi
@@ -17,21 +17,22 @@ _NOTE: The images here, just like the official once they extend, are meant to fo
## Overview

PHP image that aims to technically support running:
- eZ Platform
- eZ Platform EE
- eZ Platform/Platform Enterprise *(1.13.4 or higher)*
- eZ Publish 5.4 *(5.4.11 or higher)*
- Symfony *(As in any symfony-standard like app that have same or less requirements then eZ Platform)*

## Images

This repository contains several images for different versions of PHP\*:
- [7.2](php/Dockerfile-7.2) *(NOTE: Based on debian:stretch-slim and not jessie like the others atm in v1 format)*
- [7.1](php/Dockerfile-7.1)
- [7.0](php/Dockerfile-7.0)
- [5.6](php/Dockerfile-5.6) *(Security fixes only, time to start to move to PHP7)*
- ~~[5.5](php/Dockerfile-5.5) *(End of Life, so only meant for compatibility testing for older maintenance releases)*~~
- Extends `php:x.y-fpm` _(uses `debian:stretch-slim`)_:
- [7.3](php/Dockerfile-7.3) *(Preview, currently missing memcached php extension)*
- [7.2](php/Dockerfile-7.2)
- Extends `php:x.y-fpm-jessie` _(uses `debian:jessie`)_:
- [7.1](php/Dockerfile-7.1)
- [7.0](php/Dockerfile-7.0)
- [5.6](php/Dockerfile-5.6) *(Security fixes only, time to start to move to PHP7)*

_Recommended version for testing newest versions of eZ Platform is PHP 7.2 for best performance, however if you are currently on jessie based images (5.5-7.1) then aiming to get to PHP 7.1 is a good choice too._
_Recommended version for testing newest versions of eZ Platform is PHP 7.3 for best performance, however if you are currently on jessie based images (5.6-7.1) then aiming to get to PHP 7.1 is a good choice too._

\* *Primarily: Since this is also used to run functional testing against several PHP versions, for any other usage use the recommended image.*

@@ -116,7 +117,7 @@ For setting up a full setup with database and so on, see [ezplatform:doc/docker]
- pdo_pgsql + pdo_sqlite
- env variable to set session handler, ...
- Apache + mod_php variant
- Alpine Linux; *To drop image size, assuming all other official images move to Alpine, incl when blackfire supports it.*
- Alpine Linux; *To drop image size, assuming all other official images move to Alpine.*

## Copyright & license
Copyright [eZ Systems AS](http://ez.no/), for copyright and license details see provided LICENSE file.
@@ -78,18 +78,9 @@ docker run -ti --rm \
printf "\nVersion and module information about php build\n"
docker run -ti --rm ez_php:latest-dev bash -c "php -v; php -m"


printf "\Integration: Behat testing on ez_php:latest and ez_php:latest-dev with eZ Platform\n"
cd volumes/ezplatform

# Tag image alias for what (exactly) eZ Platform is currently using in order to be able to test across branches
## As we don't want it to pull in remote, but rather use what we just built here
## NOTE: On larger changes to this images, we would need to pull in custom branches with adaptions on Platform side as well as below
## TODO: The tag aliases here will not be needed once eZ Platform uses PHP_IMAGE variable within Dockerfile's from section
docker tag ez_php:latest "ezsystems/php:7.2-v1"
docker tag ez_php:latest "ezsystems/php:7.1-v1"
docker tag ez_php:latest "ezsystems/php:7.0-v1"

export COMPOSE_FILE="doc/docker/base-dev.yml:doc/docker/redis.yml:doc/docker/selenium.yml" SYMFONY_ENV="behat" SYMFONY_DEBUG="0" PHP_IMAGE="ez_php:latest" PHP_IMAGE_DEV="ez_php:latest-dev"
docker-compose -f doc/docker/install.yml up --abort-on-container-exit

@@ -104,8 +95,3 @@ else
fi

docker-compose down -v

# Remove custom tag aliases used for Platform testing
docker rmi "ezsystems/php:7.2-v1"
docker rmi "ezsystems/php:7.1-v1"
docker rmi "ezsystems/php:7.0-v1"
@@ -0,0 +1,125 @@
FROM php:7.3-fpm

# Container containing php-fpm and php-cli to run and interact with eZ Platform and other Symfony projects
#
# It has two modes of operation:
# - (run.sh cmd) [default] Reconfigure eZ Platform/Publish based on provided env variables and start php-fpm
# - (bash|php|composer) Allows to execute composer, php or bash against the image

# Set defaults for variables used by run.sh
ENV COMPOSER_HOME=/root/.composer

# Get packages that we need in container
RUN apt-get update -q -y \
&& apt-get install -q -y --no-install-recommends \
ca-certificates \
curl \
acl \
sudo \
# Needed for the php extensions we enable below
libfreetype6 \
libjpeg62-turbo \
libxpm4 \
libpng16-16 \
libicu57 \
libxslt1.1 \
libmemcachedutil2 \
libzip4 \
# Required by eZ Commerce
imagemagick \
# git & unzip needed for composer, unless we document to use dev image for composer install
# unzip needed due to https://github.com/composer/composer/issues/4471
unzip \
git \
&& rm -rf /var/lib/apt/lists/*

# Install and configure php plugins
RUN set -xe \
&& buildDeps=" \
$PHP_EXTRA_BUILD_DEPS \
libfreetype6-dev \
libjpeg62-turbo-dev \
libxpm-dev \
libpng-dev \
libicu-dev \
libxslt1-dev \
libmemcached-dev \
libzip-dev \
" \
&& apt-get update -q -y && apt-get install -q -y --no-install-recommends $buildDeps && rm -rf /var/lib/apt/lists/* \
# Extract php source and install missing extensions
&& docker-php-source extract \
&& docker-php-ext-configure mysqli --with-mysqli=mysqlnd \
&& docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/ --with-xpm-dir=/usr/include/ --enable-gd-jis-conv \
&& docker-php-ext-install exif gd mbstring intl xsl zip mysqli pdo_mysql \
&& docker-php-ext-enable opcache \
&& cp /usr/src/php/php.ini-production ${PHP_INI_DIR}/php.ini \
\
# Install blackfire: https://blackfire.io/docs/integrations/docker
&& version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
&& curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/linux/amd64/$version \
&& tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp \
&& mv /tmp/blackfire-*.so $(php -r "echo ini_get('extension_dir');")/blackfire.so \
&& rm -f /tmp/blackfire-probe.tar.gz \
\
# Install igbinary (for more efficient serialization in redis/memcached)
&& for i in $(seq 1 3); do pecl install -o igbinary && s=0 && break || s=$? && sleep 1; done; (exit $s) \
&& docker-php-ext-enable igbinary \
\
# Install redis (manualy build in order to be able to enable igbinary)
&& for i in $(seq 1 3); do pecl install -o --nobuild redis && s=0 && break || s=$? && sleep 1; done; (exit $s) \
&& cd "$(pecl config-get temp_dir)/redis" \
&& phpize \
&& ./configure --enable-redis-igbinary \
&& make \
&& make install \
&& docker-php-ext-enable redis \
&& cd - \
\
# Install memcached (manualy build in order to be able to enable igbinary)
&& for i in $(seq 1 3); do echo no | pecl install -o --nobuild memcached && s=0 && break || s=$? && sleep 1; done; (exit $s) \
&& cd "$(pecl config-get temp_dir)/memcached" \
&& phpize \
&& ./configure --enable-memcached-igbinary \
&& make \
&& make install \
&& docker-php-ext-enable memcached \
&& cd - \
\
# Delete source & builds deps so it does not hang around in layers taking up space
&& pecl clear-cache \
&& rm -Rf "$(pecl config-get temp_dir)/*" \
&& docker-php-source delete \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps

# Set timezone
RUN echo "UTC" > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata

# Set pid file to be able to restart php-fpm
RUN sed -i "s@^\[global\]@\[global\]\n\npid = /run/php-fpm.pid@" ${PHP_INI_DIR}-fpm.conf

COPY conf.d/blackfire.ini ${PHP_INI_DIR}/conf.d/blackfire.ini

# Create Composer directory (cache and auth files) & Get Composer
RUN mkdir -p $COMPOSER_HOME \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# As application is put in as volume we do all needed operation on run
COPY scripts /scripts

# Add some custom config
COPY conf.d/php.ini ${PHP_INI_DIR}/conf.d/php.ini

RUN chmod 755 /scripts/*.sh

# Needed for docker-machine
RUN usermod -u 1000 www-data

WORKDIR /var/www

ENTRYPOINT ["/scripts/docker-entrypoint.sh"]

CMD php-fpm

EXPOSE 9000

0 comments on commit 22cd9e8

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.