Skip to content

Commit 48b96fd

Browse files
authored
Workerman use Ubuntu 24.04 (#9042)
1 parent 2a6d458 commit 48b96fd

File tree

6 files changed

+34
-29
lines changed

6 files changed

+34
-29
lines changed

frameworks/PHP/workerman/app-pg.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,17 @@ function db()
4747

4848
function query($request)
4949
{
50+
$random = DbRaw::$random;
51+
5052
$query_count = 1;
5153
$q = (int) $request->get('q');
5254
if ($q > 1) {
5355
$query_count = min($q, 500);
5456
}
5557

5658
while ($query_count--) {
57-
DbRaw::$random->execute([mt_rand(1, 10000)]);
58-
$arr[] = DbRaw::$random->fetch();
59+
$random->execute([mt_rand(1, 10000)]);
60+
$arr[] = $random->fetch();
5961
}
6062

6163
return new Response(200, [
@@ -66,6 +68,8 @@ function query($request)
6668

6769
function updateraw($request)
6870
{
71+
$random = DbRaw::$random;
72+
6973
$query_count = 1;
7074
$q = (int) $request->get('q');
7175
if ($q > 1) {
@@ -74,8 +78,8 @@ function updateraw($request)
7478

7579
while ($query_count--) {
7680

77-
DbRaw::$random->execute([mt_rand(1, 10000)]);
78-
$row = DbRaw::$random->fetch();
81+
$random->execute([mt_rand(1, 10000)]);
82+
$row = $random->fetch();
7983
$row['randomNumber'] = mt_rand(1, 10000);
8084

8185
$worlds[] = $row;

frameworks/PHP/workerman/server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
$http_worker = new Worker('http://0.0.0.0:8080');
99
$http_worker->count = (int) shell_exec('nproc') * 4;
10-
$http_worker->onWorkerStart = function () {
10+
$http_worker->onWorkerStart = static function () {
1111
Header::$date = gmdate('D, d M Y H:i:s').' GMT';
1212
Timer::add(1, function() {
1313
Header::$date = gmdate('D, d M Y H:i:s').' GMT';

frameworks/PHP/workerman/workerman-async.dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:22.04
1+
FROM ubuntu:24.04
22

33
ARG DEBIAN_FRONTEND=noninteractive
44

@@ -8,15 +8,15 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
88

99
RUN apt-get install -yqq php8.3-cli php8.3-mysql > /dev/null
1010

11-
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
11+
COPY --from=composer/composer:latest-bin --link /composer /usr/local/bin/composer
1212

13-
RUN apt-get install -y php-pear php8.3-dev php8.3-xml libevent-dev git > /dev/null
14-
RUN pecl install event-3.1.3 > /dev/null && echo "extension=event.so" > /etc/php/8.3/cli/conf.d/event.ini
13+
RUN apt-get install -y php-pear php8.3-dev libevent-dev git > /dev/null && \
14+
pecl install event-3.1.3 > /dev/null && echo "extension=event.so" > /etc/php/8.3/cli/conf.d/event.ini
1515

16-
COPY php.ini /etc/php/8.3/cli/php.ini
16+
COPY --link php.ini /etc/php/8.3/cli/php.ini
1717

18-
ADD ./ /workerman
1918
WORKDIR /workerman
19+
COPY --link . .
2020

2121
RUN composer require react/mysql "^0.6" --quiet
2222
RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet

frameworks/PHP/workerman/workerman-pgsql.dockerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM ubuntu:22.04
1+
FROM ubuntu:24.04
2+
23
ARG DEBIAN_FRONTEND=noninteractive
34

45
RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
@@ -7,15 +8,15 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
78

89
RUN apt-get install -yqq php8.3-cli php8.3-pgsql php8.3-xml > /dev/null
910

10-
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
11+
COPY --from=composer/composer:latest-bin --link /composer /usr/local/bin/composer
1112

12-
RUN apt-get install -y php-pear php8.3-dev libevent-dev git > /dev/null
13-
RUN pecl install event-3.1.3 > /dev/null && echo "extension=event.so" > /etc/php/8.3/cli/conf.d/event.ini
13+
RUN apt-get install -y php-pear php8.3-dev libevent-dev git > /dev/null && \
14+
pecl install event-3.1.3 > /dev/null && echo "extension=event.so" > /etc/php/8.3/cli/conf.d/event.ini
1415

15-
COPY php.ini /etc/php/8.3/cli/php.ini
16+
COPY --link php.ini /etc/php/8.3/cli/php.ini
1617

17-
ADD ./ /workerman
1818
WORKDIR /workerman
19+
COPY --link . .
1920

2021
RUN sed -i "s|'/app.php|'/app-pg.php|g" server.php
2122
RUN sed -i "s|init()|DbRaw::init()|g" server.php

frameworks/PHP/workerman/workerman-php8-jit.dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:22.04
1+
FROM ubuntu:24.04
22

33
ARG DEBIAN_FRONTEND=noninteractive
44

@@ -8,15 +8,15 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
88

99
RUN apt-get install -yqq php8.3-cli php8.3-pgsql php8.3-xml > /dev/null
1010

11-
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
11+
COPY --from=composer/composer:latest-bin --link /composer /usr/local/bin/composer
1212

13-
RUN apt-get install -y php-pear php8.3-dev libevent-dev git > /dev/null
14-
RUN pecl install event-3.1.3 > /dev/null && echo "extension=event.so" > /etc/php/8.3/cli/conf.d/event.ini
13+
RUN apt-get install -y php-pear php8.3-dev libevent-dev git > /dev/null && \
14+
pecl install event-3.1.3 > /dev/null && echo "extension=event.so" > /etc/php/8.3/cli/conf.d/event.ini
1515

16-
COPY php-jit.ini /etc/php/8.3/cli/php.ini
16+
COPY --link php-jit.ini /etc/php/8.3/cli/php.ini
1717

18-
ADD ./ /workerman
1918
WORKDIR /workerman
19+
COPY --link . .
2020

2121
RUN sed -i "s|'/app.php|'/app-pg.php|g" server.php
2222
RUN sed -i "s|init()|DbRaw::init()|g" server.php

frameworks/PHP/workerman/workerman.dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:22.04
1+
FROM ubuntu:24.04
22

33
ARG DEBIAN_FRONTEND=noninteractive
44

@@ -8,15 +8,15 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
88

99
RUN apt-get install -yqq php8.3-cli php8.3-mysql php8.3-xml > /dev/null
1010

11-
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
11+
COPY --from=composer/composer:latest-bin --link /composer /usr/local/bin/composer
1212

13-
RUN apt-get install -y php-pear php8.3-dev libevent-dev git > /dev/null
14-
RUN pecl install event-3.1.3 > /dev/null && echo "extension=event.so" > /etc/php/8.3/cli/conf.d/event.ini
13+
RUN apt-get install -y php-pear php8.3-dev libevent-dev git > /dev/null && \
14+
pecl install event-3.1.3 > /dev/null && echo "extension=event.so" > /etc/php/8.3/cli/conf.d/event.ini
1515

16-
COPY php-jit.ini /etc/php/8.3/cli/php.ini
16+
COPY --link php-jit.ini /etc/php/8.3/cli/php.ini
1717

18-
ADD ./ /workerman
1918
WORKDIR /workerman
19+
COPY --link . .
2020

2121
RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
2222

0 commit comments

Comments
 (0)