Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[php] Symfony update to PHP 8.2 #7708

Merged
merged 3 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions frameworks/PHP/symfony/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"ext-ctype": "*",
"ext-iconv": "*",
"ext-mbstring": "*",
"symfony/console": "^6.0",
"symfony/dotenv": "^6.0",
"symfony/flex": "^2.0",
"symfony/framework-bundle": "^6.0",
"symfony/orm-pack": "^2.1",
"symfony/twig-bundle": "^6.0",
"symfony/console": "^6",
"symfony/dotenv": "^6",
"symfony/flex": "^2",
"symfony/framework-bundle": "^6",
"symfony/orm-pack": "^2",
"symfony/twig-bundle": "^6",
"symfony/yaml": "^6.0",
"joanhey/adapterman": "^0.5"
},
Expand Down
23 changes: 12 additions & 11 deletions frameworks/PHP/symfony/symfony-raw.dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
FROM ubuntu:20.04
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
RUN apt-get update -yqq > /dev/null && \
apt-get install -yqq nginx git unzip curl \
php8.1-cli php8.1-fpm php8.1-mysql \
php8.1-mbstring php8.1-xml php8.1-curl > /dev/null
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
apt-get update -yqq > /dev/null && apt-get upgrade -yqq > /dev/null

RUN apt-get install -yqq nginx git unzip curl \
php8.2-cli php8.2-fpm php8.2-mysql \
php8.2-mbstring php8.2-xml php8.2-curl > /dev/null

RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

COPY deploy/conf/* /etc/php/8.1/fpm/
RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/8.1/fpm/php-fpm.conf ; fi;
COPY deploy/conf/* /etc/php/8.2/fpm/
RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/8.2/fpm/php-fpm.conf ; fi;

WORKDIR /symfony
ADD ./composer.json /symfony/
RUN mkdir -m 777 -p /symfony/var/cache/{dev,prod} /symfony/var/log
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --no-scripts --quiet
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --no-scripts
ADD . /symfony
RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-autoload --no-dev --classmap-authoritative
RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-env prod
Expand All @@ -27,9 +28,9 @@ RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-env prod
#RUN sed -i '/PDO::ATTR_STATEMENT_CLASS/d' ./vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php

RUN php bin/console cache:clear
RUN echo "opcache.preload=/symfony/var/cache/prod/App_KernelProdContainer.preload.php" >> /etc/php/8.1/fpm/php.ini
RUN echo "opcache.preload=/symfony/var/cache/prod/App_KernelProdContainer.preload.php" >> /etc/php/8.2/fpm/php.ini

EXPOSE 8080

CMD service php8.1-fpm start && \
CMD service php8.2-fpm start && \
nginx -c /symfony/deploy/nginx.conf
12 changes: 6 additions & 6 deletions frameworks/PHP/symfony/symfony-swoole.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.0
FROM php:8.2-rc-cli

RUN pecl install swoole > /dev/null && \
docker-php-ext-enable swoole
Expand All @@ -16,21 +16,21 @@ COPY deploy/swoole/php.ini /usr/local/etc/php/
WORKDIR /symfony
ADD ./composer.json /symfony/
RUN mkdir -m 777 -p /symfony/var/cache/swoole /symfony/var/log
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --no-scripts --quiet
RUN COMPOSER_ALLOW_SUPERUSER=1 composer install --no-dev --no-scripts

# downgrade to doctrine-dbal 2.12 => due to a bug in version 2.13
# see https://github.com/doctrine/dbal/issues/4603
RUN composer require doctrine/orm:2.8.5 -W
RUN composer require doctrine/dbal:2.12.x -W
#RUN composer require doctrine/orm:2.8.5 -W
#RUN composer require doctrine/dbal:2.12.x -W

ADD . /symfony
RUN COMPOSER_ALLOW_SUPERUSER=1 composer require "k911/swoole-bundle:^0.9" --no-scripts --ignore-platform-reqs --quiet
RUN COMPOSER_ALLOW_SUPERUSER=1 composer require "k911/swoole-bundle:^0.10" --no-scripts --with-all-dependencies
RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-autoload --no-dev --classmap-authoritative
RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-env swoole

# removes hardcoded option `ATTR_STATEMENT_CLASS` conflicting with `ATTR_PERSISTENT`. Hack not needed when upgrading to Doctrine 3
# see https://github.com/doctrine/dbal/issues/2315
RUN sed -i '/PDO::ATTR_STATEMENT_CLASS/d' ./vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php
#RUN sed -i '/PDO::ATTR_STATEMENT_CLASS/d' ./vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php

# Force debug=0 because env is not "prod"
ENV APP_DEBUG=0
Expand Down
17 changes: 9 additions & 8 deletions frameworks/PHP/symfony/symfony-workerman.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@ FROM ubuntu:22.04
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
RUN apt-get update -yqq > /dev/null && \
apt-get install -yqq git unzip \
php8.1-cli php8.1-mysql php8.1-mbstring php8.1-xml php8.1-curl > /dev/null
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
apt-get update -yqq > /dev/null && apt-get upgrade -yqq > /dev/null

RUN apt-get install -yqq git unzip \
php8.2-cli php8.2-mysql php8.2-mbstring php8.2-xml php8.2-curl > /dev/null

COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

RUN apt-get install -y php-pear php8.1-dev libevent-dev > /dev/null
RUN pecl install event-3.0.8 > /dev/null && echo "extension=event.so" > /etc/php/8.1/cli/conf.d/event.ini
RUN apt-get install -y php-pear php8.2-dev libevent-dev > /dev/null
RUN pecl install event-3.0.8 > /dev/null && echo "extension=event.so" > /etc/php/8.2/cli/conf.d/event.ini

EXPOSE 8080

WORKDIR /symfony
ADD ./composer.json /symfony/
RUN mkdir -m 777 -p /symfony/var/cache/{dev,prod} /symfony/var/log
RUN composer install --no-dev --no-scripts --quiet
RUN composer install --no-dev --no-scripts

# downgrade to doctrine-dbal 2.12 => due to a bug in version 2.13
# see https://github.com/doctrine/dbal/issues/4603
Expand All @@ -35,6 +36,6 @@ RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-env prod

RUN php bin/console cache:clear

COPY deploy/conf/cli-php.ini /etc/php/8.1/cli/php.ini
COPY deploy/conf/cli-php.ini /etc/php/8.2/cli/php.ini

CMD php server.php start
21 changes: 11 additions & 10 deletions frameworks/PHP/symfony/symfony.dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
FROM ubuntu:20.04
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
RUN apt-get update -yqq > /dev/null && \
apt-get install -yqq nginx git unzip curl \
php8.1-cli php8.1-fpm php8.1-mysql \
php8.1-mbstring php8.1-xml php8.1-curl php8.1-dev > /dev/null
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
apt-get update -yqq > /dev/null && apt-get upgrade -yqq > /dev/null

RUN apt-get install -yqq nginx git unzip curl \
php8.2-cli php8.2-fpm php8.2-mysql \
php8.2-mbstring php8.2-xml php8.2-curl php8.2-dev > /dev/null

RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

COPY deploy/conf/* /etc/php/8.1/fpm/
RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/8.1/fpm/php-fpm.conf ; fi;
COPY deploy/conf/* /etc/php/8.2/fpm/
RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/8.2/fpm/php-fpm.conf ; fi;

WORKDIR /symfony
ADD ./composer.json /symfony/
Expand All @@ -33,7 +34,7 @@ RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-env prod
#RUN sed -i '/PDO::ATTR_STATEMENT_CLASS/d' ./vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php

RUN php bin/console cache:clear
RUN echo "opcache.preload=/symfony/var/cache/prod/App_KernelProdContainer.preload.php" >> /etc/php/8.1/fpm/php.ini
RUN echo "opcache.preload=/symfony/var/cache/prod/App_KernelProdContainer.preload.php" >> /etc/php/8.2/fpm/php.ini

CMD service php8.1-fpm start && \
CMD service php8.2-fpm start && \
nginx -c /symfony/deploy/nginx.conf