diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 86cc9d9..3a2c2f2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,23 +20,32 @@ jobs: matrix: php: - "7.4" - - "8.0" - - "8.1" - - "8.2" node: - - "18" + - "20" product-version: - "~4.6.x-dev" - include: - - php: "7.3" - product-version: "~3.3.x-dev" - node: "14" - - php: "7.3" - product-version: "~3.3.x-dev" - node: "16" - - php: "7.3" - product-version: "~3.3.x-dev" - node: "18" +# include: +# - php: "7.3" +# product-version: "~3.3.x-dev" +# node: "14" +# - php: "7.4" +# product-version: "~3.3.x-dev" +# node: "16" +# - php: "8.3" +# product-version: "~3.3.x-dev" +# node: "18" +# - php: "7.4" +# product-version: "~4.6.x-dev" +# node: "18" +# - php: "8.0" +# product-version: "~4.6.x-dev" +# node: "20" +# - php: "8.3" +# product-version: "~5.0.x-dev" +# node: "22" +# - php: "8.4" +# product-version: "~5.0.x-dev" +# node: "22" steps: - uses: actions/checkout@v4 diff --git a/bin/ci/test.sh b/bin/ci/test.sh index ddac23f..7b8c6ac 100755 --- a/bin/ci/test.sh +++ b/bin/ci/test.sh @@ -23,7 +23,7 @@ APP_ENV="prod" BEHAT_REQUIREMENT="ibexa/behat:$PRODUCT_VERSION" if [ "$PRODUCT_VERSION" = "~3.3.x-dev" ]; then - BEHAT_REQUIREMENT="ezsystems/behatbundle:^8.3.x-dev" + BEHAT_REQUIREMENT="ezsystems/behatbundle:dev-bump-psy" fi if [ "$REUSE_VOLUME" = "0" ]; then @@ -64,7 +64,7 @@ docker run -i --rm ibexa_php:latest-node bash -c "php -v; php -m" printf "\nVersion and module information about php build with enabled xdebug\n" docker run -i --rm -e ENABLE_XDEBUG="1" ibexa_php:latest-node bash -c "php -v; php -m" -printf "\Integration: Behat testing on ibexa_php:latest and ibexa_php:latest-node with eZ Platform\n" +printf "\nIntegration: Behat testing on ibexa_php:latest and ibexa_php:latest-node with eZ Platform\n" cd volumes/ezplatform export COMPOSE_FILE="doc/docker/base-dev.yml:doc/docker/redis.yml:doc/docker/selenium.yml" @@ -74,6 +74,13 @@ export PHP_IMAGE="ibexa_php:latest-node" PHP_IMAGE_DEV="ibexa_php:latest-node" docker compose --env-file .env up -d --build --force-recreate echo '> Workaround for test issues: Change ownership of files inside docker container' docker compose --env-file=.env exec -T app sh -c 'chown -R www-data:www-data /var/www' +if [ "$PRODUCT_VERSION" = "~3.3.x-dev" ]; then + if docker run -i --rm ibexa_php:latest-node bash -c "php -v" | grep -q '8.3'; then + echo '> Set PHP 8.2+ Ibexa error handler to avoid deprecations' + docker compose --env-file=.env exec -T --user www-data app sh -c "composer config extra.runtime.error_handler \"\\Ibexa\\Contracts\\Core\\MVC\\Symfony\\ErrorHandler\\Php82HideDeprecationsErrorHandler\"" + docker compose --env-file=.env exec -T --user www-data app sh -c "composer dump-autoload" + fi +fi # Rebuild Symfony container docker compose --env-file=.env exec -T --user www-data app sh -c "rm -rf var/cache/*" docker compose --env-file=.env exec -T --user www-data app php bin/console cache:clear diff --git a/php/Dockerfile-8.3 b/php/Dockerfile-8.3 new file mode 100644 index 0000000..38259ab --- /dev/null +++ b/php/Dockerfile-8.3 @@ -0,0 +1,154 @@ +FROM php:8.3-fpm-bullseye + +# Container containing php-fpm and php-cli to run and interact with Ibexa DXP + +# 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 + # gd + libfreetype6 \ + libjpeg62-turbo \ + libxpm4 \ + libpng16-16 \ + # intl + libicu67 \ + # xslt + libxslt1.1 \ + # memcached + libmemcachedutil2 \ + # zip + libzip4 \ + # imagick + imagemagick \ + # mbstring + libonig5 \ + # PostgreSQL + libpq5 \ +# 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 \ +# packages useful for dev + less \ + mariadb-client \ + vim \ + wget \ + tree \ + gdb-minimal \ + && rm -rf /var/lib/apt/lists/* + +# Install and configure php plugins +RUN set -xe \ + && buildDeps=" \ + # gd + libjpeg62-turbo-dev \ + libpng-dev \ + libxpm-dev \ + libfreetype6-dev \ + # PostgreSQL + libpq-dev \ + # mbstring \ + libonig-dev \ + # intl + libicu-dev \ + # xsl + libxslt1-dev \ + # zip + libzip-dev \ + # imagick + libmagickwand-dev \ + # memcached + libmemcached-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 pgsql -with-pgsql=/usr/local/pgsql \ + && docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-xpm=/usr/include/ --enable-gd-jis-conv \ + && docker-php-ext-install exif gd mbstring intl xsl zip mysqli pdo_mysql pdo_pgsql pgsql soap bcmath sockets \ + && docker-php-ext-enable opcache \ + && cp /usr/src/php/php.ini-production ${PHP_INI_DIR}/php.ini \ + \ +# Install imagemagick + && for i in $(seq 1 3); do pecl install -o imagick && s=0 && break || s=$? && sleep 1; done; (exit $s) \ + && docker-php-ext-enable imagick \ +# Install xdebug + && for i in $(seq 1 3); do echo yes | pecl install -o "xdebug" && s=0 && break || s=$? && sleep 1; done; (exit $s) \ +# 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 +COPY conf.d/xdebug.ini ${PHP_INI_DIR}/conf.d/xdebug.ini.disabled + +# 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 diff --git a/php/Dockerfile-8.4 b/php/Dockerfile-8.4 new file mode 100644 index 0000000..51913d1 --- /dev/null +++ b/php/Dockerfile-8.4 @@ -0,0 +1,154 @@ +FROM php:8.4-fpm-bullseye + +# Container containing php-fpm and php-cli to run and interact with Ibexa DXP + +# 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 + # gd + libfreetype6 \ + libjpeg62-turbo \ + libxpm4 \ + libpng16-16 \ + # intl + libicu67 \ + # xslt + libxslt1.1 \ + # memcached + libmemcachedutil2 \ + # zip + libzip4 \ + # imagick + imagemagick \ + # mbstring + libonig5 \ + # PostgreSQL + libpq5 \ +# 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 \ +# packages useful for dev + less \ + mariadb-client \ + vim \ + wget \ + tree \ + gdb-minimal \ + && rm -rf /var/lib/apt/lists/* + +# Install and configure php plugins +RUN set -xe \ + && buildDeps=" \ + # gd + libjpeg62-turbo-dev \ + libpng-dev \ + libxpm-dev \ + libfreetype6-dev \ + # PostgreSQL + libpq-dev \ + # mbstring \ + libonig-dev \ + # intl + libicu-dev \ + # xsl + libxslt1-dev \ + # zip + libzip-dev \ + # imagick + libmagickwand-dev \ + # memcached + libmemcached-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 pgsql -with-pgsql=/usr/local/pgsql \ + && docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ --with-xpm=/usr/include/ --enable-gd-jis-conv \ + && docker-php-ext-install exif gd mbstring intl xsl zip mysqli pdo_mysql pdo_pgsql pgsql soap bcmath sockets \ + && docker-php-ext-enable opcache \ + && cp /usr/src/php/php.ini-production ${PHP_INI_DIR}/php.ini \ + \ +# Install imagemagick + && for i in $(seq 1 3); do pecl install -o imagick && s=0 && break || s=$? && sleep 1; done; (exit $s) \ + && docker-php-ext-enable imagick \ +# Install xdebug + && for i in $(seq 1 3); do echo yes | pecl install -o "xdebug" && s=0 && break || s=$? && sleep 1; done; (exit $s) \ +# 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 +COPY conf.d/xdebug.ini ${PHP_INI_DIR}/conf.d/xdebug.ini.disabled + +# 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 diff --git a/php/Dockerfile-node20 b/php/Dockerfile-node20 new file mode 100644 index 0000000..cce32e8 --- /dev/null +++ b/php/Dockerfile-node20 @@ -0,0 +1,11 @@ +FROM ibexa_php:latest + +# Install Node.js and Yarn +RUN apt-get update -q -y \ + && apt-get install -q -y --no-install-recommends gnupg \ + && curl -sL https://deb.nodesource.com/setup_20.x | bash - \ + && apt-get install -y nodejs \ + && curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ + && sudo apt-get update && sudo apt-get install yarn \ + && rm -rf /var/lib/apt/lists/* diff --git a/php/Dockerfile-node22 b/php/Dockerfile-node22 new file mode 100644 index 0000000..a3d5225 --- /dev/null +++ b/php/Dockerfile-node22 @@ -0,0 +1,11 @@ +FROM ibexa_php:latest + +# Install Node.js and Yarn +RUN apt-get update -q -y \ + && apt-get install -q -y --no-install-recommends gnupg \ + && curl -sL https://deb.nodesource.com/setup_22.x | bash - \ + && apt-get install -y nodejs \ + && curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ + && sudo apt-get update && sudo apt-get install yarn \ + && rm -rf /var/lib/apt/lists/*