From 7b64e688bed738c1c3dcf8144531daa302c066aa Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Sun, 21 Jul 2024 20:51:19 -0400 Subject: [PATCH] Bind the service on 0.0.0.0, test if it works in Docker contains properly now. --- app/composer.lock | 128 +++++++++++++++++++++++++++++------------- app/server/server.php | 5 +- deploy/php/Dockerfile | 2 + docker-compose.yml | 6 ++ 4 files changed, 101 insertions(+), 40 deletions(-) diff --git a/app/composer.lock b/app/composer.lock index 3ce5bcc..1c6e482 100644 --- a/app/composer.lock +++ b/app/composer.lock @@ -8,24 +8,28 @@ "packages": [ { "name": "cakephp/chronos", - "version": "3.0.4", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/cakephp/chronos.git", - "reference": "9cb035acd10152a6b74df936986f15c4e6015bd3" + "reference": "786d69e1ee4b735765cbdb5521b9603e9b98d650" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/chronos/zipball/9cb035acd10152a6b74df936986f15c4e6015bd3", - "reference": "9cb035acd10152a6b74df936986f15c4e6015bd3", + "url": "https://api.github.com/repos/cakephp/chronos/zipball/786d69e1ee4b735765cbdb5521b9603e9b98d650", + "reference": "786d69e1ee4b735765cbdb5521b9603e9b98d650", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.1", + "psr/clock": "^1.0" + }, + "provide": { + "psr/clock-implementation": "1.0" }, "require-dev": { "cakephp/cakephp-codesniffer": "^5.0", - "phpunit/phpunit": "^10.1.0" + "phpunit/phpunit": "^10.1.0 || ^11.1.3" }, "type": "library", "autoload": { @@ -59,7 +63,7 @@ "issues": "https://github.com/cakephp/chronos/issues", "source": "https://github.com/cakephp/chronos" }, - "time": "2023-10-17T07:41:48+00:00" + "time": "2024-07-18T03:18:04+00:00" }, { "name": "cakephp/core", @@ -541,24 +545,24 @@ }, { "name": "graham-campbell/result-type", - "version": "v1.1.2", + "version": "v1.1.3", "source": { "type": "git", "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862" + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/fbd48bce38f73f8a4ec8583362e732e4095e5862", - "reference": "fbd48bce38f73f8a4ec8583362e732e4095e5862", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945", + "reference": "3ba905c11371512af9d9bdd27d99b782216b6945", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2" + "phpoption/phpoption": "^1.9.3" }, "require-dev": { - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" }, "type": "library", "autoload": { @@ -587,7 +591,7 @@ ], "support": { "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.2" + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3" }, "funding": [ { @@ -599,7 +603,7 @@ "type": "tidelift" } ], - "time": "2023-11-12T22:16:48+00:00" + "time": "2024-07-20T21:45:45+00:00" }, { "name": "laravel/serializable-closure", @@ -1423,16 +1427,16 @@ }, { "name": "php-di/php-di", - "version": "7.0.6", + "version": "7.0.7", "source": { "type": "git", "url": "https://github.com/PHP-DI/PHP-DI.git", - "reference": "8097948a89f6ec782839b3e958432f427cac37fd" + "reference": "e87435e3c0e8f22977adc5af0d5cdcc467e15cf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/8097948a89f6ec782839b3e958432f427cac37fd", - "reference": "8097948a89f6ec782839b3e958432f427cac37fd", + "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/e87435e3c0e8f22977adc5af0d5cdcc467e15cf1", + "reference": "e87435e3c0e8f22977adc5af0d5cdcc467e15cf1", "shasum": "" }, "require": { @@ -1480,7 +1484,7 @@ ], "support": { "issues": "https://github.com/PHP-DI/PHP-DI/issues", - "source": "https://github.com/PHP-DI/PHP-DI/tree/7.0.6" + "source": "https://github.com/PHP-DI/PHP-DI/tree/7.0.7" }, "funding": [ { @@ -1492,20 +1496,20 @@ "type": "tidelift" } ], - "time": "2023-11-02T10:04:50+00:00" + "time": "2024-07-21T15:55:45+00:00" }, { "name": "phpoption/phpoption", - "version": "1.9.2", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820" + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/80735db690fe4fc5c76dfa7f9b770634285fa820", - "reference": "80735db690fe4fc5c76dfa7f9b770634285fa820", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/e3fac8b24f56113f7cb96af14958c0dd16330f54", + "reference": "e3fac8b24f56113f7cb96af14958c0dd16330f54", "shasum": "" }, "require": { @@ -1513,13 +1517,13 @@ }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", - "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" }, "type": "library", "extra": { "bamarni-bin": { "bin-links": true, - "forward-command": true + "forward-command": false }, "branch-alias": { "dev-master": "1.9-dev" @@ -1555,7 +1559,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.9.2" + "source": "https://github.com/schmittjoh/php-option/tree/1.9.3" }, "funding": [ { @@ -1567,7 +1571,55 @@ "type": "tidelift" } ], - "time": "2023-11-12T21:59:55+00:00" + "time": "2024-07-20T21:41:07+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" }, { "name": "psr/container", @@ -4304,23 +4356,23 @@ }, { "name": "vlucas/phpdotenv", - "version": "v5.6.0", + "version": "v5.6.1", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4" + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", - "reference": "2cf9fb6054c2bb1d59d1f3817706ecdb9d2934c4", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/a59a13791077fe3d44f90e7133eb68e7d22eaff2", + "reference": "a59a13791077fe3d44f90e7133eb68e7d22eaff2", "shasum": "" }, "require": { "ext-pcre": "*", - "graham-campbell/result-type": "^1.1.2", + "graham-campbell/result-type": "^1.1.3", "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.2", + "phpoption/phpoption": "^1.9.3", "symfony/polyfill-ctype": "^1.24", "symfony/polyfill-mbstring": "^1.24", "symfony/polyfill-php80": "^1.24" @@ -4337,7 +4389,7 @@ "extra": { "bamarni-bin": { "bin-links": true, - "forward-command": true + "forward-command": false }, "branch-alias": { "dev-master": "5.6-dev" @@ -4372,7 +4424,7 @@ ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.0" + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.1" }, "funding": [ { @@ -4384,7 +4436,7 @@ "type": "tidelift" } ], - "time": "2023-11-12T22:43:29+00:00" + "time": "2024-07-20T21:52:34+00:00" } ], "packages-dev": [ diff --git a/app/server/server.php b/app/server/server.php index f7bd9a4..d79e07e 100644 --- a/app/server/server.php +++ b/app/server/server.php @@ -10,8 +10,9 @@ use Psr\Http\Message\ServerRequestInterface as Request; try { $app = Bootstrap::init(); $http = new HttpServer(fn (Request $request) => $app->handle($request)); - $address = "127.0.0.1:8000"; - $socket = new SocketServer($address); + $address = "0.0.0.0"; + $port = "8000"; + $socket = new SocketServer($address . ":" . $port); $http->on('error', function ($error) use ($socket) { fprintf(STDERR, $error->getMessage() . "\n"); diff --git a/deploy/php/Dockerfile b/deploy/php/Dockerfile index 4081edf..ab51ed8 100644 --- a/deploy/php/Dockerfile +++ b/deploy/php/Dockerfile @@ -11,4 +11,6 @@ RUN composer install \ --no-progress \ --optimize-autoloader +EXPOSE 8000 + CMD [ "php", "server/server.php" ] diff --git a/docker-compose.yml b/docker-compose.yml index 03a3481..a0bdc99 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,12 @@ services: - "3306:3306" volumes: - slovocast_db:/var/lib/mysql/data/ + app: + build: + content: . + dockerfile: deploy/php/Dockerfile + ports: + - "8000:8000" volumes: slovocast_db: