Compare commits

...

15 Commits

Author SHA1 Message Date
Ronald A. Richardson
9b938e84c5 updated nginx config for timeout and logging 2023-06-11 12:15:05 +08:00
Ronald A. Richardson
672ac85d7d updated docker-compose.yml 2023-06-11 11:55:03 +08:00
Ronald A. Richardson
9decae6e26 set target as app-dev for application 2023-06-11 11:33:11 +08:00
Ronald A. Richardson
6d4d037d2f removed all shared volumes from docker environment - only use for dev, drop httpd container 2023-06-11 11:01:36 +08:00
Ronald A. Richardson
3969473b99 updated Dockerfile to handle permission issues and patch composer install and dump, as well as dependency updates for api 2023-06-09 16:08:38 +08:00
Ronald A. Richardson
cb23dda979 updated api to use fleetbase/core-api#v1.0.6-alpha 2023-06-09 12:39:23 +08:00
Ronald A. Richardson
8a2ce65763 updated fleetbase/core-api to v1.0.5-alpha to add server IP as CORS origin 2023-06-09 12:08:50 +08:00
Ronald A. Richardson
b4c4012557 updated console to v0.0.7 which includes window.crypto.randomUUID polyfill patch 2023-06-09 11:22:09 +08:00
Ronald A. Richardson
8683f1b0ca Admin System Configuration v1 ready 2023-06-08 18:43:34 +08:00
Ronald A. Richardson
80774383bc bump console to v0.0.5 for firefox patches 2023-06-07 21:22:08 +08:00
Ronald A. Richardson
acf3c66c9f patch Dockerfile 2023-06-07 19:15:37 +08:00
Ronald A. Richardson
4e635716bb patched Dockerfile, console updated to v0.0.4 with all latest dependencies 2023-06-07 18:36:53 +08:00
Ronald A. Richardson
f3240c049f console now builds for production 2023-06-06 14:21:10 +07:00
Ronald A. Richardson
3d1140d45c oops, dont use local dir for api depn 2023-06-05 11:28:32 +07:00
Ronald A. Richardson
bbd02e4e8a update core-api to v1.0.3-alpha 2023-06-05 11:24:36 +07:00
15 changed files with 326 additions and 118 deletions

View File

@@ -6,16 +6,18 @@
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fleetbase/core-api": "^1.0.2-alpha",
"fleetbase/fleetops-api": "^1.0.1-alpha",
"fleetbase/storefront-api": "^1.0.1-alpha",
"fleetbase/core-api": "^1.0.8-alpha",
"fleetbase/fleetops-api": "^1.0.2-alpha",
"fleetbase/storefront-api": "^1.0.2-alpha",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.75",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5",
"league/flysystem-aws-s3-v3": "^1.0",
"maatwebsite/excel": "^3.1",
"phpoffice/phpspreadsheet": "^1.28",
"predis/predis": "^2.1",
"psr/http-factory-implementation": "*",
"textalk/websocket": "^1.6"
},

266
api/composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "fc2f7eb52a3de2ba9cc3cc470b59a10f",
"content-hash": "826dc512e204fa573464c081ccc63408",
"packages": [
{
"name": "aloha/twilio",
@@ -192,16 +192,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.271.3",
"version": "3.272.1",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "f481134d37b8303fa2e82ca7fe2a3124144057f6"
"reference": "a0accaf4a16565c0b4438109c978602f27dff3a0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/f481134d37b8303fa2e82ca7fe2a3124144057f6",
"reference": "f481134d37b8303fa2e82ca7fe2a3124144057f6",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a0accaf4a16565c0b4438109c978602f27dff3a0",
"reference": "a0accaf4a16565c0b4438109c978602f27dff3a0",
"shasum": ""
},
"require": {
@@ -281,9 +281,9 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.271.3"
"source": "https://github.com/aws/aws-sdk-php/tree/3.272.1"
},
"time": "2023-05-26T18:20:00+00:00"
"time": "2023-06-09T18:21:02+00:00"
},
{
"name": "aws/aws-sdk-php-laravel",
@@ -2002,16 +2002,16 @@
},
{
"name": "fleetbase/core-api",
"version": "1.0.2-alpha",
"version": "1.0.8-alpha",
"source": {
"type": "git",
"url": "https://github.com/fleetbase/core-api.git",
"reference": "1a9ba870f4a1fc5bd8f471b654ad9498f2d17d43"
"reference": "04c9e13efb21fa352fa5d821ae316e1f2bfb9e45"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fleetbase/core-api/zipball/1a9ba870f4a1fc5bd8f471b654ad9498f2d17d43",
"reference": "1a9ba870f4a1fc5bd8f471b654ad9498f2d17d43",
"url": "https://api.github.com/repos/fleetbase/core-api/zipball/04c9e13efb21fa352fa5d821ae316e1f2bfb9e45",
"reference": "04c9e13efb21fa352fa5d821ae316e1f2bfb9e45",
"shasum": ""
},
"require": {
@@ -2085,7 +2085,7 @@
],
"support": {
"issues": "https://github.com/fleetbase/core-api/issues",
"source": "https://github.com/fleetbase/core-api/tree/v1.0.2-alpha"
"source": "https://github.com/fleetbase/core-api/tree/v1.0.8-alpha"
},
"funding": [
{
@@ -2093,20 +2093,20 @@
"type": "github"
}
],
"time": "2023-05-30T08:31:50+00:00"
"time": "2023-06-11T02:52:00+00:00"
},
{
"name": "fleetbase/fleetops-api",
"version": "1.0.1-alpha",
"version": "1.0.2-alpha",
"source": {
"type": "git",
"url": "https://github.com/fleetbase/fleetops-api.git",
"reference": "3bcce25a9cf2c9bc991aac26e873ac6eeacaac68"
"reference": "a6a9eab63eb651f8833874c2ee34739c4b8f1d9b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fleetbase/fleetops-api/zipball/3bcce25a9cf2c9bc991aac26e873ac6eeacaac68",
"reference": "3bcce25a9cf2c9bc991aac26e873ac6eeacaac68",
"url": "https://api.github.com/repos/fleetbase/fleetops-api/zipball/a6a9eab63eb651f8833874c2ee34739c4b8f1d9b",
"reference": "a6a9eab63eb651f8833874c2ee34739c4b8f1d9b",
"shasum": ""
},
"require": {
@@ -2167,7 +2167,7 @@
],
"support": {
"issues": "https://github.com/fleetbase/fleetops-api/issues",
"source": "https://github.com/fleetbase/fleetops-api/tree/v1.0.1-alpha"
"source": "https://github.com/fleetbase/fleetops-api/tree/v1.0.2-alpha"
},
"funding": [
{
@@ -2175,25 +2175,25 @@
"type": "github"
}
],
"time": "2023-05-26T04:34:49+00:00"
"time": "2023-06-08T10:35:17+00:00"
},
{
"name": "fleetbase/storefront-api",
"version": "1.0.1-alpha",
"version": "1.0.2-alpha",
"source": {
"type": "git",
"url": "https://github.com/fleetbase/storefront-api.git",
"reference": "0d0dee2b8a173757e0f4e5c4e12c98d6d6dda37e"
"reference": "44cb6d4d91ee1ba0c76476ec9d6273bf887f8883"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fleetbase/storefront-api/zipball/0d0dee2b8a173757e0f4e5c4e12c98d6d6dda37e",
"reference": "0d0dee2b8a173757e0f4e5c4e12c98d6d6dda37e",
"url": "https://api.github.com/repos/fleetbase/storefront-api/zipball/44cb6d4d91ee1ba0c76476ec9d6273bf887f8883",
"reference": "44cb6d4d91ee1ba0c76476ec9d6273bf887f8883",
"shasum": ""
},
"require": {
"fleetbase/core-api": "^1.0.0-alpha",
"fleetbase/fleetops-api": "^1.0.0-alpha",
"fleetbase/core-api": "^1.0.7-alpha",
"fleetbase/fleetops-api": "^1.0.2-alpha",
"geocoder-php/google-maps-places-provider": "^1.4",
"laravel-notification-channels/apn": "^3.8",
"laravel-notification-channels/fcm": "^2.7",
@@ -2251,7 +2251,7 @@
],
"support": {
"issues": "https://github.com/fleetbase/storefront-api/issues",
"source": "https://github.com/fleetbase/storefront-api/tree/v1.0.1-alpha"
"source": "https://github.com/fleetbase/storefront-api/tree/v1.0.2-alpha"
},
"funding": [
{
@@ -2259,7 +2259,7 @@
"type": "github"
}
],
"time": "2023-05-26T04:39:13+00:00"
"time": "2023-06-09T08:00:56+00:00"
},
{
"name": "fruitcake/laravel-cors",
@@ -2741,16 +2741,16 @@
},
{
"name": "giggsey/libphonenumber-for-php",
"version": "8.13.12",
"version": "8.13.13",
"source": {
"type": "git",
"url": "https://github.com/giggsey/libphonenumber-for-php.git",
"reference": "218caeeeb224bf2f553597b5c3a1647ff936db64"
"reference": "a8996558d694b1437678d27de80e37620367b8de"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/giggsey/libphonenumber-for-php/zipball/218caeeeb224bf2f553597b5c3a1647ff936db64",
"reference": "218caeeeb224bf2f553597b5c3a1647ff936db64",
"url": "https://api.github.com/repos/giggsey/libphonenumber-for-php/zipball/a8996558d694b1437678d27de80e37620367b8de",
"reference": "a8996558d694b1437678d27de80e37620367b8de",
"shasum": ""
},
"require": {
@@ -2809,7 +2809,7 @@
"issues": "https://github.com/giggsey/libphonenumber-for-php/issues",
"source": "https://github.com/giggsey/libphonenumber-for-php"
},
"time": "2023-05-22T07:19:16+00:00"
"time": "2023-06-05T07:39:05+00:00"
},
{
"name": "giggsey/locale",
@@ -3897,16 +3897,16 @@
},
{
"name": "kreait/firebase-php",
"version": "6.9.5",
"version": "6.9.6",
"source": {
"type": "git",
"url": "https://github.com/kreait/firebase-php.git",
"reference": "e64ce87a2d3be0acef91c33aea6269bbd528b12f"
"reference": "d6592be9b27a7c0b13f484f5af494e278901e441"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kreait/firebase-php/zipball/e64ce87a2d3be0acef91c33aea6269bbd528b12f",
"reference": "e64ce87a2d3be0acef91c33aea6269bbd528b12f",
"url": "https://api.github.com/repos/kreait/firebase-php/zipball/d6592be9b27a7c0b13f484f5af494e278901e441",
"reference": "d6592be9b27a7c0b13f484f5af494e278901e441",
"shasum": ""
},
"require": {
@@ -3926,7 +3926,6 @@
"mtdowling/jmespath.php": "^2.6.1",
"php": "^7.4|^8.0",
"psr/cache": "^1.0.1|^2.0|^3.0",
"psr/http-message": "^1.0.1",
"psr/log": "^1.1|^2.0|^3.0",
"riverline/multipart-parser": "^2.0.8",
"symfony/polyfill-php80": "^1.23",
@@ -3987,7 +3986,7 @@
"type": "github"
}
],
"time": "2023-01-27T09:30:40+00:00"
"time": "2023-06-10T06:44:56+00:00"
},
{
"name": "kreait/firebase-tokens",
@@ -5217,6 +5216,71 @@
],
"time": "2022-10-04T09:16:37+00:00"
},
{
"name": "league/flysystem-aws-s3-v3",
"version": "1.0.30",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git",
"reference": "af286f291ebab6877bac0c359c6c2cb017eb061d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/af286f291ebab6877bac0c359c6c2cb017eb061d",
"reference": "af286f291ebab6877bac0c359c6c2cb017eb061d",
"shasum": ""
},
"require": {
"aws/aws-sdk-php": "^3.20.0",
"league/flysystem": "^1.0.40",
"php": ">=5.5.0"
},
"require-dev": {
"henrikbjorn/phpspec-code-coverage": "~1.0.1",
"phpspec/phpspec": "^2.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"League\\Flysystem\\AwsS3v3\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Frank de Jonge",
"email": "info@frenky.net"
}
],
"description": "Flysystem adapter for the AWS S3 SDK v3.x",
"support": {
"issues": "https://github.com/thephpleague/flysystem-aws-s3-v3/issues",
"source": "https://github.com/thephpleague/flysystem-aws-s3-v3/tree/1.0.30"
},
"funding": [
{
"url": "https://offset.earth/frankdejonge",
"type": "custom"
},
{
"url": "https://github.com/frankdejonge",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/league/flysystem",
"type": "tidelift"
}
],
"time": "2022-07-02T13:51:38+00:00"
},
{
"name": "league/geotools",
"version": "1.1.0",
@@ -7743,6 +7807,64 @@
},
"time": "2022-09-07T10:27:55+00:00"
},
{
"name": "predis/predis",
"version": "v2.1.2",
"source": {
"type": "git",
"url": "https://github.com/predis/predis.git",
"reference": "a77a43913a74f9331f637bb12867eb8e274814e5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/predis/predis/zipball/a77a43913a74f9331f637bb12867eb8e274814e5",
"reference": "a77a43913a74f9331f637bb12867eb8e274814e5",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.3",
"phpstan/phpstan": "^1.9",
"phpunit/phpunit": "^8.0 || ~9.4.4"
},
"type": "library",
"autoload": {
"psr-4": {
"Predis\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Till Krüss",
"homepage": "https://till.im",
"role": "Maintainer"
}
],
"description": "A flexible and feature-complete Redis client for PHP.",
"homepage": "http://github.com/predis/predis",
"keywords": [
"nosql",
"predis",
"redis"
],
"support": {
"issues": "https://github.com/predis/predis/issues",
"source": "https://github.com/predis/predis/tree/v2.1.2"
},
"funding": [
{
"url": "https://github.com/sponsors/tillkruss",
"type": "github"
}
],
"time": "2023-03-02T18:32:04+00:00"
},
{
"name": "psr/cache",
"version": "1.0.1",
@@ -13469,16 +13591,16 @@
},
{
"name": "doctrine/dbal",
"version": "3.6.2",
"version": "3.6.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "b4bd1cfbd2b916951696d82e57d054394d84864c"
"reference": "9a747d29e7e6b39509b8f1847e37a23a0163ea6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/b4bd1cfbd2b916951696d82e57d054394d84864c",
"reference": "b4bd1cfbd2b916951696d82e57d054394d84864c",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/9a747d29e7e6b39509b8f1847e37a23a0163ea6a",
"reference": "9a747d29e7e6b39509b8f1847e37a23a0163ea6a",
"shasum": ""
},
"require": {
@@ -13491,12 +13613,12 @@
"psr/log": "^1|^2|^3"
},
"require-dev": {
"doctrine/coding-standard": "11.1.0",
"doctrine/coding-standard": "12.0.0",
"fig/log-test": "^1",
"jetbrains/phpstorm-stubs": "2022.3",
"phpstan/phpstan": "1.10.9",
"phpstan/phpstan": "1.10.14",
"phpstan/phpstan-strict-rules": "^1.5",
"phpunit/phpunit": "9.6.6",
"phpunit/phpunit": "9.6.7",
"psalm/plugin-phpunit": "0.18.4",
"squizlabs/php_codesniffer": "3.7.2",
"symfony/cache": "^5.4|^6.0",
@@ -13561,7 +13683,7 @@
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/3.6.2"
"source": "https://github.com/doctrine/dbal/tree/3.6.3"
},
"funding": [
{
@@ -13577,29 +13699,33 @@
"type": "tidelift"
}
],
"time": "2023-04-14T07:25:38+00:00"
"time": "2023-06-01T05:46:46+00:00"
},
{
"name": "doctrine/deprecations",
"version": "v1.1.0",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/deprecations.git",
"reference": "8cffffb2218e01f3b370bf763e00e81697725259"
"reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/8cffffb2218e01f3b370bf763e00e81697725259",
"reference": "8cffffb2218e01f3b370bf763e00e81697725259",
"url": "https://api.github.com/repos/doctrine/deprecations/zipball/612a3ee5ab0d5dd97b7cf3874a6efe24325efac3",
"reference": "612a3ee5ab0d5dd97b7cf3874a6efe24325efac3",
"shasum": ""
},
"require": {
"php": "^7.1|^8.0"
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^9",
"phpunit/phpunit": "^7.5|^8.5|^9.5",
"psr/log": "^1|^2|^3"
"phpstan/phpstan": "1.4.10 || 1.10.15",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5",
"psalm/plugin-phpunit": "0.18.4",
"psr/log": "^1 || ^2 || ^3",
"vimeo/psalm": "4.30.0 || 5.12.0"
},
"suggest": {
"psr/log": "Allows logging deprecations via PSR-3 logger implementation"
@@ -13618,9 +13744,9 @@
"homepage": "https://www.doctrine-project.org/",
"support": {
"issues": "https://github.com/doctrine/deprecations/issues",
"source": "https://github.com/doctrine/deprecations/tree/v1.1.0"
"source": "https://github.com/doctrine/deprecations/tree/v1.1.1"
},
"time": "2023-05-29T18:55:17+00:00"
"time": "2023-06-03T09:27:29+00:00"
},
{
"name": "doctrine/event-manager",
@@ -14307,38 +14433,44 @@
},
{
"name": "mockery/mockery",
"version": "1.5.1",
"version": "1.6.2",
"source": {
"type": "git",
"url": "https://github.com/mockery/mockery.git",
"reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e"
"reference": "13a7fa2642c76c58fa2806ef7f565344c817a191"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mockery/mockery/zipball/e92dcc83d5a51851baf5f5591d32cb2b16e3684e",
"reference": "e92dcc83d5a51851baf5f5591d32cb2b16e3684e",
"url": "https://api.github.com/repos/mockery/mockery/zipball/13a7fa2642c76c58fa2806ef7f565344c817a191",
"reference": "13a7fa2642c76c58fa2806ef7f565344c817a191",
"shasum": ""
},
"require": {
"hamcrest/hamcrest-php": "^2.0.1",
"lib-pcre": ">=7.0",
"php": "^7.3 || ^8.0"
"php": "^7.4 || ^8.0"
},
"conflict": {
"phpunit/phpunit": "<8.0"
},
"require-dev": {
"phpunit/phpunit": "^8.5 || ^9.3"
"phpunit/phpunit": "^8.5 || ^9.3",
"psalm/plugin-phpunit": "^0.18",
"vimeo/psalm": "^5.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4.x-dev"
"dev-main": "1.6.x-dev"
}
},
"autoload": {
"psr-0": {
"Mockery": "library/"
"files": [
"library/helpers.php",
"library/Mockery.php"
],
"psr-4": {
"Mockery\\": "library/Mockery"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -14373,9 +14505,9 @@
],
"support": {
"issues": "https://github.com/mockery/mockery/issues",
"source": "https://github.com/mockery/mockery/tree/1.5.1"
"source": "https://github.com/mockery/mockery/tree/1.6.2"
},
"time": "2022-09-07T15:32:08+00:00"
"time": "2023-06-07T09:07:52+00:00"
},
{
"name": "myclabs/deep-copy",

Submodule console updated: bf512c392f...1c955bb8a0

View File

@@ -38,14 +38,14 @@ services:
ENVIRONMENT: development
application:
volumes:
- .:/var/www/html
build:
context: .
dockerfile: docker/Dockerfile
target: app-dev
args:
ENVIRONMENT: development
ports:
- "8000:80"
environment:
DATABASE_URL: "mysql://root@database/fleetbase"
CACHE_DRIVER: redis
@@ -58,18 +58,4 @@ services:
LOG_CHANNEL: daily
depends_on:
- database
- cache
httpd:
volumes:
- ./api/storage:/var/www/html/api/storage
build:
context: .
dockerfile: docker/httpd/Dockerfile
ports:
- "8000:80"
depends_on:
- application
volumes:
storage:
- cache

View File

@@ -8,9 +8,9 @@ RUN mkdir -p /usr/src/php/ext \
# Install required packages and PHP extensions
RUN apt-get update \
&& apt-get install -y git unzip libzip-dev libgd-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
&& apt-get install -y nano git unzip libzip-dev libgd-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
imagemagick libmagickwand-dev --no-install-recommends libmemcached-dev libgeos-dev libgmp-dev \
default-mysql-client libicu-dev tmux \
default-mysql-client libicu-dev tmux nginx dnsutils \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-configure gd --with-external-gd \
@@ -19,6 +19,9 @@ RUN apt-get update \
&& pecl install redis-4.3.0 memcached-3.1.3 \
&& docker-php-ext-enable redis memcached opcache bcmath
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Update PHP configurations
RUN sed -e 's/^expose_php.*/expose_php = Off/' "$PHP_INI_DIR/php.ini-production" > "$PHP_INI_DIR/php.ini" \
&& sed -i -e 's/^upload_max_filesize.*/upload_max_filesize = 600M/' -e 's/^post_max_size.*/post_max_size = 0/' \
@@ -30,27 +33,29 @@ RUN curl -L https://github.com/springload/ssm-parent/releases/download/v1.4.3/ss
&& rm /tmp/ssm-parent.tar.gz
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy packages
COPY packages /var/www/html/packages
# Setup application
WORKDIR /var/www/html/api
# Set ownership and permissions
RUN chown www-data:www-data /var/www/html \
&& chown www-data:www-data /var/www/html/api
COPY --chown=www-data:nogroup api ./
RUN chown -R www-data:www-data /var/www/html/api
RUN mkdir -p ./storage/logs/ && ln -sf /dev/stdout ./storage/logs/laravel-$(date +'%Y-%m-%d').log
USER www-data
RUN mkdir -p ./storage/logs/ \
&& ln -sf /dev/stdout ./storage/logs/laravel.log
# Install Composer dependencies
COPY api/composer.json api/composer.lock ./
RUN composer install --no-dev --no-scripts --no-autoloader
# Copy application files
COPY --chown=www-data:nogroup . ./
RUN composer install
RUN composer dumpautoload
# Continue
USER root
WORKDIR /
# Copy nginx config
COPY nginx.conf /etc/nginx/sites-enabled/default
# Copy the startup script into the Docker image
COPY startup.sh /startup.sh
# Make sure the script is executable
RUN chmod +x /startup.sh
# Set environment
ARG ENVIRONMENT=production
@@ -76,13 +81,14 @@ CMD ["go-crond", "--verbose", "--no-auto", "root:./crontab"]
# Application dev stage
FROM base as app-dev
ENTRYPOINT ["docker-php-entrypoint"]
CMD ["php-fpm"]
ENTRYPOINT ["docker-php-entrypoint"]
EXPOSE 80
CMD ["/startup.sh"]
# Events stage
FROM base as events
ENTRYPOINT ["/sbin/ssm-parent", "-c", ".ssm-parent.yaml", "run", "--", "docker-php-entrypoint"]
CMD ["php", "artisan", "queue:work", "events"]
CMD ["php", "artisan", "queue:work", "events"]2
# Jobs stage
FROM base as jobs
@@ -92,4 +98,5 @@ CMD ["php", "artisan", "queue:work", "sqs"]
# Application stage
FROM base as app
ENTRYPOINT ["/sbin/ssm-parent", "-c", ".ssm-parent.yaml", "run", "--", "docker-php-entrypoint"]
CMD ["php-fpm"]
EXPOSE 80
CMD ["/startup.sh"]

46
nginx.conf Normal file
View File

@@ -0,0 +1,46 @@
server {
listen 80;
server_name localhost;
root /var/www/html/api/public;
# hide nginx version for security purposes
server_tokens off;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error_log;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location /uploads {
alias /var/www/html/api/storage/app/uploads;
autoindex on;
try_files $uri $uri/ /index.php?$query_string;
}
location /storage {
alias /var/www/html/api/storage/app/public;
autoindex on;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass application:9000;
fastcgi_index index.php;
}
}

35
startup.sh Normal file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
# Start PHP-FPM in the background
php-fpm -D
status=$?
if [ $status -ne 0 ]; then
echo "Failed to start php-fpm: $status"
exit $status
fi
# Start Nginx in the foreground
nginx -g "daemon off;"
status=$?
if [ $status -ne 0 ]; then
echo "Failed to start nginx: $status"
exit $status
fi
# Naive check runs checks once a minute to see if either of the processes exited.
while sleep 60; do
ps aux | grep php-fpm | grep -q -v grep
PROCESS_1_STATUS=$?
ps aux |grep nginx |grep -q -v grep
PROCESS_2_STATUS=$?
if [ $PROCESS_1_STATUS -ne 0 ]; then
echo "PHP-FPM process has already exited."
exit 1
fi
if [ $PROCESS_2_STATUS -ne 0 ]; then
echo "Nginx process has already exited."
exit 1
fi
done