Skip to content
This repository was archived by the owner on May 14, 2020. It is now read-only.

Commit f49028d

Browse files
committed
1) Heroku compatibility.
2) Improved Dockerfile ENTRYPOINT & CMD instructions.
1 parent 6f14a06 commit f49028d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ RUN chmod +x /usr/bin/server
1616
EXPOSE 8080
1717
WORKDIR /app
1818

19-
ENTRYPOINT server run
19+
ENTRYPOINT ["server"]
20+
CMD ["run"]

src/Application.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,10 @@ private function putConfigurationToObjects(): void
282282
*/
283283
private function createServer(): Server
284284
{
285-
$server = new Server(
286-
$this->conf->get('server.host'),
287-
$this->conf->get('server.port'),
288-
SWOOLE_PROCESS
289-
);
285+
$host = $this->conf->get('server.host');
286+
$port = (int) getenv('PORT') ?: $this->conf->get('server.port'); // Heroku compatibility.
287+
288+
$server = new Server($host, $port, SWOOLE_PROCESS);
290289

291290
// swoole compression disabled and it not possible to override.
292291
$compress = [

0 commit comments

Comments
 (0)