Skip to content
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
8 changes: 4 additions & 4 deletions frameworks/PHP/symfony/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ Uses Twig 2.11.
## Infrastructure Software Versions
The tests were run with:

* [Symfony 4.3](https://symfony.com/)
* [PHP Version 7.3](https://www.php.net/) with FPM and OPcache
* [nginx 1.15](https://nginx.org/)
* [MySQL 5.7](https://dev.mysql.com/)
* [Symfony](https://symfony.com/)
* [PHP](https://www.php.net/) with FPM and OPcache
* [nginx ](https://nginx.org/)
* [MySQL](https://dev.mysql.com/)


## Test URLs
Expand Down
5 changes: 1 addition & 4 deletions frameworks/PHP/symfony/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.4",
"php": ">=7.4",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-mbstring": "*",
Expand All @@ -17,9 +17,6 @@
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"platform": {
"php": "7.4"
},
"preferred-install": {
"*": "dist"
},
Expand Down
4 changes: 2 additions & 2 deletions frameworks/PHP/symfony/deploy/conf/php-fpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
; Pid file
; Note: the default prefix is /var
; Default Value: none
pid = /run/php/php7.3-fpm.pid
pid = /run/php/php-fpm.pid

; Error log file
; If it's set to "syslog", log is sent to syslogd instead of being written
Expand Down Expand Up @@ -161,7 +161,7 @@ group = www-data
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /run/php/php7.3-fpm.sock
listen = /run/php/php-fpm.sock

; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
Expand Down
3 changes: 2 additions & 1 deletion frameworks/PHP/symfony/deploy/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ user www-data;
worker_processes auto;
error_log stderr error;
worker_rlimit_nofile 200000;
daemon off;

events {
worker_connections 16384;
Expand Down Expand Up @@ -41,7 +42,7 @@ http {


upstream fastcgi_backend {
server unix:/var/run/php/php7.3-fpm.sock;
server unix:/var/run/php/php-fpm.sock;
keepalive 40;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Entity\Fortune;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Persistence\ManagerRegistry;

class FortuneRepository extends ServiceEntityRepository
{
Expand Down
2 changes: 1 addition & 1 deletion frameworks/PHP/symfony/src/Repository/WorldRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Entity\World;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Persistence\ManagerRegistry;

class WorldRepository extends ServiceEntityRepository
{
Expand Down
19 changes: 10 additions & 9 deletions frameworks/PHP/symfony/symfony-raw.dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
FROM ubuntu:20.04
FROM ubuntu:20.10

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 php7.4 php7.4-common php7.4-cli php7.4-fpm php7.4-mysql > /dev/null
RUN apt-get install -yqq php7.4-mbstring php7.4-xml > /dev/null
apt-get install -yqq nginx git unzip curl \
php8.0-cli php8.0-fpm php8.0-mysql \
php8.0-mbstring php8.0-xml php8.0-curl > /dev/null

RUN apt-get install -yqq composer > /dev/null
RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

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

WORKDIR /symfony
ADD ./composer.json /symfony/
Expand All @@ -26,9 +27,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/7.4/fpm/php.ini
RUN echo "opcache.preload=/symfony/var/cache/prod/App_KernelProdContainer.preload.php" >> /etc/php/8.0/fpm/php.ini

EXPOSE 8080

CMD service php7.4-fpm start && \
nginx -c /symfony/deploy/nginx.conf -g "daemon off;"
CMD service php8.0-fpm start && \
nginx -c /symfony/deploy/nginx.conf
9 changes: 4 additions & 5 deletions frameworks/PHP/symfony/symfony-swoole.dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
FROM php:7.4
FROM php:8.0

RUN pecl install swoole > /dev/null && \
docker-php-ext-enable swoole

RUN pecl install apcu > /dev/null && \
docker-php-ext-enable apcu

RUN docker-php-ext-install pdo pdo_mysql opcache > /dev/null

RUN apt-get update -yqq && \
apt-get install -yqq git unzip
apt-get install -yqq libicu-dev git unzip > /dev/null && \
docker-php-ext-install pdo_mysql opcache intl > /dev/null

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

Expand All @@ -19,7 +18,7 @@ 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
ADD . /symfony
RUN COMPOSER_ALLOW_SUPERUSER=1 composer require "k911/swoole-bundle:^0.7.8" --no-scripts --quiet
RUN COMPOSER_ALLOW_SUPERUSER=1 composer require "k911/swoole-bundle:^0.9" --no-scripts --ignore-platform-reqs --quiet
RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-autoload --no-dev --classmap-authoritative
RUN COMPOSER_ALLOW_SUPERUSER=1 composer dump-env swoole

Expand Down
23 changes: 11 additions & 12 deletions frameworks/PHP/symfony/symfony.dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
FROM ubuntu:20.04
FROM ubuntu:20.10

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 php7.4 php7.4-common php7.4-cli php7.4-fpm php7.4-mysql > /dev/null
RUN apt-get install -yqq php7.4-mbstring php7.4-xml > /dev/null
apt-get install -yqq nginx git unzip curl \
php8.0-cli php8.0-fpm php8.0-mysql \
php8.0-mbstring php8.0-xml php8.0-curl > /dev/null

RUN apt-get install -yqq composer > /dev/null
RUN curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

COPY deploy/conf/* /etc/php/7.4/fpm/
RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/7.4/fpm/php-fpm.conf ; fi;
COPY deploy/conf/* /etc/php/8.0/fpm/
RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/8.0/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 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 @@ -26,9 +27,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/7.4/fpm/php.ini
RUN echo "opcache.preload=/symfony/var/cache/prod/App_KernelProdContainer.preload.php" >> /etc/php/8.0/fpm/php.ini

EXPOSE 8080

CMD service php7.4-fpm start && \
nginx -c /symfony/deploy/nginx.conf -g "daemon off;"
CMD service php8.0-fpm start && \
nginx -c /symfony/deploy/nginx.conf