Skip to content

Commit

Permalink
[php] Laravel udpate to Adapterman 0.6 and PHP 8.2 (#8023)
Browse files Browse the repository at this point in the history
* Laravel update to Adapterman 0.6

* Delete autoload

* Laravel update to PHP 8.2
  • Loading branch information
joanhey authored Mar 13, 2023
1 parent 6ba215e commit 683b97f
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion frameworks/PHP/laravel/deploy/conf/cli-php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ memory_limit = 512M
opcache.jit_buffer_size = 128M
opcache.jit = tracing

disable_functions=header,header_remove,http_response_code,setcookie,session_create_id,session_id,session_name,session_save_path,session_status,session_start,session_write_close,session_regenerate_id,set_time_limit
disable_functions=header,header_remove,headers_sent,http_response_code,setcookie,session_create_id,session_id,session_name,session_save_path,session_status,session_start,session_write_close,session_regenerate_id,set_time_limit
2 changes: 1 addition & 1 deletion frameworks/PHP/laravel/deploy/workerman/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"require": {
"php": "^8.0",
"laravel/framework": "^8.0",
"joanhey/adapterman": "^0.5"
"joanhey/adapterman": "^0.6"
},
"require-dev": {
"facade/ignition": "^2.3.6",
Expand Down
6 changes: 3 additions & 3 deletions frameworks/PHP/laravel/laravel-laravel-s.dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM php:8.1-cli
FROM php:8.2-cli

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

RUN echo "opcache.enable_cli=1" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
#RUN echo "opcache.jit=1205" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
#RUN echo "opcache.jit_buffer_size=128M" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN echo "opcache.jit=1205" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN echo "opcache.jit_buffer_size=128M" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini

ADD ./ /laravel
WORKDIR /laravel
Expand Down
2 changes: 1 addition & 1 deletion frameworks/PHP/laravel/laravel-roadrunner.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.1-cli
FROM php:8.2-cli

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

Expand Down
6 changes: 3 additions & 3 deletions frameworks/PHP/laravel/laravel-swoole.dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM php:8.1-cli
FROM php:8.2-cli

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

RUN echo "opcache.enable_cli=1" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
#RUN echo "opcache.jit=1205" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
#RUN echo "opcache.jit_buffer_size=128M" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN echo "opcache.jit=1205" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
RUN echo "opcache.jit_buffer_size=128M" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini

ADD ./ /laravel
WORKDIR /laravel
Expand Down
8 changes: 4 additions & 4 deletions frameworks/PHP/laravel/laravel-workerman.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ 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.1-cli php8.1-mysql php8.1-mbstring php8.1-xml php8.1-curl > /dev/null
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

ADD ./ /laravel
WORKDIR /laravel
Expand All @@ -26,6 +26,6 @@ COPY deploy/workerman/composer.json ./
RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
RUN php artisan optimize

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-man.php start
12 changes: 6 additions & 6 deletions frameworks/PHP/laravel/laravel.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

Expand All @@ -7,16 +7,16 @@ 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 \
php8.1-cli php8.1-fpm php8.1-mysql php8.1-mbstring php8.1-xml php8.1-dev > /dev/null
php8.2-cli php8.2-fpm php8.2-mysql php8.2-mbstring php8.2-xml php8.2-dev > /dev/null

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

COPY deploy/conf/* /etc/php/8.1/fpm/
COPY deploy/conf/* /etc/php/8.2/fpm/

ADD ./ /laravel
WORKDIR /laravel

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;
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;

RUN mkdir -p /laravel/bootstrap/cache /laravel/storage/logs /laravel/storage/framework/sessions /laravel/storage/framework/views /laravel/storage/framework/cache
RUN chmod -R 777 /laravel
Expand All @@ -27,8 +27,8 @@ RUN php artisan optimize
EXPOSE 8080

# Uncomment next line for Laravel console error logging to be viewable in docker logs
# RUN echo "catch_workers_output = yes" >> /etc/php/8.1/fpm/php-fpm.conf
# RUN echo "catch_workers_output = yes" >> /etc/php/8.2/fpm/php-fpm.conf

RUN mkdir -p /run/php
CMD /usr/sbin/php-fpm8.1 --fpm-config /etc/php/8.1/fpm/php-fpm.conf && \
CMD /usr/sbin/php-fpm8.2 --fpm-config /etc/php/8.2/fpm/php-fpm.conf && \
nginx -c /laravel/deploy/nginx.conf
4 changes: 2 additions & 2 deletions frameworks/PHP/laravel/server-man.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
$http_worker = new Worker('http://0.0.0.0:8080');
$http_worker->count = (int) shell_exec('nproc') * 4;
$http_worker->name = 'AdapterMan-Laravel';
$http_worker->onWorkerStart = function () {
$http_worker->onWorkerStart = static function () {
Header::$date = gmdate('D, d M Y H:i:s').' GMT';
Timer::add(1, function() {
Header::$date = gmdate('D, d M Y H:i:s').' GMT';
Expand All @@ -20,7 +20,7 @@
require __DIR__.'/start.php';
};

$http_worker->onMessage = static function ($connection, $request) {
$http_worker->onMessage = static function ($connection) {

$connection->send(run());
};
Expand Down
2 changes: 1 addition & 1 deletion frameworks/PHP/laravel/start.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
|
*/

require __DIR__.'/vendor/autoload.php';
//require __DIR__.'/vendor/autoload.php';

/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit 683b97f

Please sign in to comment.