Skip to content

Commit 9e0cffc

Browse files
committed
wip
1 parent edd0d85 commit 9e0cffc

File tree

2 files changed

+30
-8
lines changed

2 files changed

+30
-8
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
FROM dunglas/frankenphp
22

3-
COPY . /app/public
4-
53
RUN install-php-extensions \
64
pdo_mysql \
75
gd \
86
intl \
97
zip \
108
opcache
119

10+
COPY . /app
11+
1212
ENV FRANKENPHP_CONFIG="worker ./public/index.php"

public/index.php

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,36 @@
11
<?php
22

3-
declare(strict_types=1);
4-
53
use Tempest\Discovery\DiscoveryLocation;
64
use Tempest\Router\HttpApplication;
5+
use Tempest\Router\WorkerApplication;
76

87
require_once __DIR__ . '/../vendor/autoload.php';
98

10-
HttpApplication::boot(__DIR__ . '/../', discoveryLocations: [
11-
new DiscoveryLocation('Tests\\Tempest\\Fixtures\\', __DIR__ . '/../tests/Fixtures/'),
12-
])->run();
9+
if (function_exists('frankenphp_handle_request')) {
10+
ignore_user_abort(true);
11+
12+
$application = WorkerApplication::boot(__DIR__ . '/../');
13+
14+
$handler = static function () {
15+
// $application->run();
16+
echo 'hi';
17+
};
18+
19+
$maxRequests = (int)($_SERVER['MAX_REQUESTS'] ?? 0);
20+
21+
for ($nbRequests = 0; ! $maxRequests || $nbRequests < $maxRequests; ++$nbRequests) {
22+
$keepRunning = frankenphp_handle_request($handler);
23+
24+
gc_collect_cycles();
25+
26+
if (! $keepRunning) break;
27+
}
28+
} else {
29+
HttpApplication::boot(__DIR__ . '/../', discoveryLocations: [
30+
new DiscoveryLocation('Tests\\Tempest\\Fixtures\\', __DIR__ . '/../tests/Fixtures/'),
31+
])->run();
32+
33+
exit();
34+
35+
}
1336

14-
exit();

0 commit comments

Comments
 (0)