update docker

This commit is contained in:
khanh97dev 2023-11-09 14:43:24 +07:00
parent 9eb2d92c5f
commit 124f4088cc
12 changed files with 430 additions and 58 deletions

View File

@ -1,5 +0,0 @@
#!/bin/bash
source .env
echo "run artisan..."
docker exec -it "$DOCKER_CONTAINER_NAME" php artisan "$@"

View File

@ -59,4 +59,4 @@ VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
# DOCKER
DOCKER_CONTAINER_NAME=be-start-template
DOCKER_CONTAINER_NAME=be-starter-template

5
Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM docker.io/bitnami/laravel:10
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT /docker-entrypoint.sh

View File

@ -9,7 +9,9 @@
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.3",
"laravel/tinker": "^2.8"
"laravel/tinker": "^2.8",
"nwidart/laravel-modules": "^10.0",
"tymon/jwt-auth": "^2.0"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
@ -31,7 +33,10 @@
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"files": [
"app/Helpers/Helper.php"
]
},
"scripts": {
"post-autoload-dump": [

395
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": "9c491b8531eec05ba41a11d9276a5749",
"content-hash": "0ee9767f00746a5153b3429424824636",
"packages": [
{
"name": "brick/math",
@ -972,16 +972,16 @@
},
{
"name": "laravel/framework",
"version": "v10.30.1",
"version": "v10.31.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "7a2da50258c4d0f693b738d3f3c69b2693aea6c1"
"reference": "507ce9b28bce4b5e4140c28943092ca38e9a52e4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/7a2da50258c4d0f693b738d3f3c69b2693aea6c1",
"reference": "7a2da50258c4d0f693b738d3f3c69b2693aea6c1",
"url": "https://api.github.com/repos/laravel/framework/zipball/507ce9b28bce4b5e4140c28943092ca38e9a52e4",
"reference": "507ce9b28bce4b5e4140c28943092ca38e9a52e4",
"shasum": ""
},
"require": {
@ -1170,7 +1170,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2023-11-01T13:52:17+00:00"
"time": "2023-11-07T13:48:30+00:00"
},
{
"name": "laravel/prompts",
@ -1231,16 +1231,16 @@
},
{
"name": "laravel/sanctum",
"version": "v3.3.1",
"version": "v3.3.2",
"source": {
"type": "git",
"url": "https://github.com/laravel/sanctum.git",
"reference": "338f633e6487e76b255470d3373fbc29228aa971"
"reference": "e1a272893bec13cf135627f7e156030b3afe1e60"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/sanctum/zipball/338f633e6487e76b255470d3373fbc29228aa971",
"reference": "338f633e6487e76b255470d3373fbc29228aa971",
"url": "https://api.github.com/repos/laravel/sanctum/zipball/e1a272893bec13cf135627f7e156030b3afe1e60",
"reference": "e1a272893bec13cf135627f7e156030b3afe1e60",
"shasum": ""
},
"require": {
@ -1293,7 +1293,7 @@
"issues": "https://github.com/laravel/sanctum/issues",
"source": "https://github.com/laravel/sanctum"
},
"time": "2023-09-07T15:46:33+00:00"
"time": "2023-11-03T13:42:14+00:00"
},
{
"name": "laravel/serializable-closure",
@ -1424,6 +1424,144 @@
},
"time": "2023-08-15T14:27:00+00:00"
},
{
"name": "lcobucci/clock",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/lcobucci/clock.git",
"reference": "30a854ceb22bd87d83a7a4563b3f6312453945fc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lcobucci/clock/zipball/30a854ceb22bd87d83a7a4563b3f6312453945fc",
"reference": "30a854ceb22bd87d83a7a4563b3f6312453945fc",
"shasum": ""
},
"require": {
"php": "~8.2.0",
"psr/clock": "^1.0"
},
"provide": {
"psr/clock-implementation": "1.0"
},
"require-dev": {
"infection/infection": "^0.26",
"lcobucci/coding-standard": "^10.0.0",
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.10.7",
"phpstan/phpstan-deprecation-rules": "^1.1.3",
"phpstan/phpstan-phpunit": "^1.3.10",
"phpstan/phpstan-strict-rules": "^1.5.0",
"phpunit/phpunit": "^10.0.17"
},
"type": "library",
"autoload": {
"psr-4": {
"Lcobucci\\Clock\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Luís Cobucci",
"email": "lcobucci@gmail.com"
}
],
"description": "Yet another clock abstraction",
"support": {
"issues": "https://github.com/lcobucci/clock/issues",
"source": "https://github.com/lcobucci/clock/tree/3.1.0"
},
"funding": [
{
"url": "https://github.com/lcobucci",
"type": "github"
},
{
"url": "https://www.patreon.com/lcobucci",
"type": "patreon"
}
],
"time": "2023-03-20T19:12:25+00:00"
},
{
"name": "lcobucci/jwt",
"version": "4.3.0",
"source": {
"type": "git",
"url": "https://github.com/lcobucci/jwt.git",
"reference": "4d7de2fe0d51a96418c0d04004986e410e87f6b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lcobucci/jwt/zipball/4d7de2fe0d51a96418c0d04004986e410e87f6b4",
"reference": "4d7de2fe0d51a96418c0d04004986e410e87f6b4",
"shasum": ""
},
"require": {
"ext-hash": "*",
"ext-json": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"ext-sodium": "*",
"lcobucci/clock": "^2.0 || ^3.0",
"php": "^7.4 || ^8.0"
},
"require-dev": {
"infection/infection": "^0.21",
"lcobucci/coding-standard": "^6.0",
"mikey179/vfsstream": "^1.6.7",
"phpbench/phpbench": "^1.2",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^1.4",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpunit/php-invoker": "^3.1",
"phpunit/phpunit": "^9.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Lcobucci\\JWT\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Luís Cobucci",
"email": "lcobucci@gmail.com",
"role": "Developer"
}
],
"description": "A simple library to work with JSON Web Token and JSON Web Signature",
"keywords": [
"JWS",
"jwt"
],
"support": {
"issues": "https://github.com/lcobucci/jwt/issues",
"source": "https://github.com/lcobucci/jwt/tree/4.3.0"
},
"funding": [
{
"url": "https://github.com/lcobucci",
"type": "github"
},
{
"url": "https://www.patreon.com/lcobucci",
"type": "patreon"
}
],
"time": "2023-01-02T13:28:00+00:00"
},
{
"name": "league/commonmark",
"version": "2.4.1",
@ -1614,16 +1752,16 @@
},
{
"name": "league/flysystem",
"version": "3.18.0",
"version": "3.19.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "015633a05aee22490495159237a5944091d8281e"
"reference": "1b2aa10f2326e0351399b8ce68e287d8e9209a83"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/015633a05aee22490495159237a5944091d8281e",
"reference": "015633a05aee22490495159237a5944091d8281e",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/1b2aa10f2326e0351399b8ce68e287d8e9209a83",
"reference": "1b2aa10f2326e0351399b8ce68e287d8e9209a83",
"shasum": ""
},
"require": {
@ -1688,7 +1826,7 @@
],
"support": {
"issues": "https://github.com/thephpleague/flysystem/issues",
"source": "https://github.com/thephpleague/flysystem/tree/3.18.0"
"source": "https://github.com/thephpleague/flysystem/tree/3.19.0"
},
"funding": [
{
@ -1700,20 +1838,20 @@
"type": "github"
}
],
"time": "2023-10-20T17:59:40+00:00"
"time": "2023-11-07T09:04:28+00:00"
},
{
"name": "league/flysystem-local",
"version": "3.18.0",
"version": "3.19.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem-local.git",
"reference": "e7381ef7643f658b87efb7dbe98fe538fb1bbf32"
"reference": "8d868217f9eeb4e9a7320db5ccad825e9a7a4076"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/e7381ef7643f658b87efb7dbe98fe538fb1bbf32",
"reference": "e7381ef7643f658b87efb7dbe98fe538fb1bbf32",
"url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/8d868217f9eeb4e9a7320db5ccad825e9a7a4076",
"reference": "8d868217f9eeb4e9a7320db5ccad825e9a7a4076",
"shasum": ""
},
"require": {
@ -1748,7 +1886,7 @@
],
"support": {
"issues": "https://github.com/thephpleague/flysystem-local/issues",
"source": "https://github.com/thephpleague/flysystem-local/tree/3.18.0"
"source": "https://github.com/thephpleague/flysystem-local/tree/3.19.0"
},
"funding": [
{
@ -1760,7 +1898,7 @@
"type": "github"
}
],
"time": "2023-10-19T20:07:13+00:00"
"time": "2023-11-06T20:35:28+00:00"
},
{
"name": "league/mime-type-detection",
@ -2315,6 +2453,91 @@
],
"time": "2023-02-08T01:06:31+00:00"
},
{
"name": "nwidart/laravel-modules",
"version": "10.0.3",
"source": {
"type": "git",
"url": "https://github.com/nWidart/laravel-modules.git",
"reference": "786da1e6dfa2df6caa8718acb9c37a8fe94595b3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nWidart/laravel-modules/zipball/786da1e6dfa2df6caa8718acb9c37a8fe94595b3",
"reference": "786da1e6dfa2df6caa8718acb9c37a8fe94595b3",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": ">=8.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.6",
"laravel/framework": "^10.0",
"mockery/mockery": "^1.5",
"orchestra/testbench": "^8.0",
"phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^10.0",
"spatie/phpunit-snapshot-assertions": "^5.0"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Nwidart\\Modules\\LaravelModulesServiceProvider"
],
"aliases": {
"Module": "Nwidart\\Modules\\Facades\\Module"
}
},
"branch-alias": {
"dev-master": "10.0-dev"
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Nwidart\\Modules\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Widart",
"email": "n.widart@gmail.com",
"homepage": "https://nicolaswidart.com",
"role": "Developer"
}
],
"description": "Laravel Module management",
"keywords": [
"laravel",
"module",
"modules",
"nwidart",
"rad"
],
"support": {
"issues": "https://github.com/nWidart/laravel-modules/issues",
"source": "https://github.com/nWidart/laravel-modules/tree/10.0.3"
},
"funding": [
{
"url": "https://github.com/dcblogdev",
"type": "github"
},
{
"url": "https://github.com/nwidart",
"type": "github"
}
],
"time": "2023-11-02T17:47:33+00:00"
},
{
"name": "phpoption/phpoption",
"version": "1.9.1",
@ -3017,16 +3240,16 @@
},
{
"name": "ramsey/uuid",
"version": "4.7.4",
"version": "4.7.5",
"source": {
"type": "git",
"url": "https://github.com/ramsey/uuid.git",
"reference": "60a4c63ab724854332900504274f6150ff26d286"
"reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/60a4c63ab724854332900504274f6150ff26d286",
"reference": "60a4c63ab724854332900504274f6150ff26d286",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e",
"reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e",
"shasum": ""
},
"require": {
@ -3093,7 +3316,7 @@
],
"support": {
"issues": "https://github.com/ramsey/uuid/issues",
"source": "https://github.com/ramsey/uuid/tree/4.7.4"
"source": "https://github.com/ramsey/uuid/tree/4.7.5"
},
"funding": [
{
@ -3105,7 +3328,7 @@
"type": "tidelift"
}
],
"time": "2023-04-15T23:01:58+00:00"
"time": "2023-11-08T05:53:05+00:00"
},
{
"name": "symfony/console",
@ -5411,6 +5634,90 @@
},
"time": "2023-01-03T09:29:04+00:00"
},
{
"name": "tymon/jwt-auth",
"version": "2.0.0",
"source": {
"type": "git",
"url": "https://github.com/tymondesigns/jwt-auth.git",
"reference": "b0868a5b00801889a9e0c81a737963d8004e708c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tymondesigns/jwt-auth/zipball/b0868a5b00801889a9e0c81a737963d8004e708c",
"reference": "b0868a5b00801889a9e0c81a737963d8004e708c",
"shasum": ""
},
"require": {
"illuminate/auth": "^9.0|^10.0",
"illuminate/contracts": "^9.0|^10.0",
"illuminate/http": "^9.0|^10.0",
"illuminate/support": "^9.0|^10.0",
"lcobucci/jwt": "^4.0",
"nesbot/carbon": "^2.0",
"php": "^8.0"
},
"require-dev": {
"illuminate/console": "^9.0|^10.0",
"illuminate/database": "^9.0|^10.0",
"illuminate/routing": "^9.0|^10.0",
"mockery/mockery": ">=0.9.9",
"phpunit/phpunit": "^9.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-develop": "1.0-dev",
"dev-2.x": "2.0-dev"
},
"laravel": {
"aliases": {
"JWTAuth": "Tymon\\JWTAuth\\Facades\\JWTAuth",
"JWTFactory": "Tymon\\JWTAuth\\Facades\\JWTFactory"
},
"providers": [
"Tymon\\JWTAuth\\Providers\\LaravelServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Tymon\\JWTAuth\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Sean Tymon",
"email": "tymon148@gmail.com",
"homepage": "https://tymon.xyz",
"role": "Developer"
}
],
"description": "JSON Web Token Authentication for Laravel and Lumen",
"homepage": "https://github.com/tymondesigns/jwt-auth",
"keywords": [
"Authentication",
"JSON Web Token",
"auth",
"jwt",
"laravel"
],
"support": {
"issues": "https://github.com/tymondesigns/jwt-auth/issues",
"source": "https://github.com/tymondesigns/jwt-auth"
},
"funding": [
{
"url": "https://www.patreon.com/seantymon",
"type": "patreon"
}
],
"time": "2023-02-16T16:29:41+00:00"
},
{
"name": "vlucas/phpdotenv",
"version": "v5.5.0",
@ -5699,16 +6006,16 @@
},
{
"name": "filp/whoops",
"version": "2.15.3",
"version": "2.15.4",
"source": {
"type": "git",
"url": "https://github.com/filp/whoops.git",
"reference": "c83e88a30524f9360b11f585f71e6b17313b7187"
"reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/filp/whoops/zipball/c83e88a30524f9360b11f585f71e6b17313b7187",
"reference": "c83e88a30524f9360b11f585f71e6b17313b7187",
"url": "https://api.github.com/repos/filp/whoops/zipball/a139776fa3f5985a50b509f2a02ff0f709d2a546",
"reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546",
"shasum": ""
},
"require": {
@ -5758,7 +6065,7 @@
],
"support": {
"issues": "https://github.com/filp/whoops/issues",
"source": "https://github.com/filp/whoops/tree/2.15.3"
"source": "https://github.com/filp/whoops/tree/2.15.4"
},
"funding": [
{
@ -5766,7 +6073,7 @@
"type": "github"
}
],
"time": "2023-07-13T12:00:00+00:00"
"time": "2023-11-03T12:00:00+00:00"
},
{
"name": "hamcrest/hamcrest-php",
@ -5821,16 +6128,16 @@
},
{
"name": "laravel/pint",
"version": "v1.13.5",
"version": "v1.13.6",
"source": {
"type": "git",
"url": "https://github.com/laravel/pint.git",
"reference": "df105cf8ce7a8f0b8a9425ff45cd281a5448e423"
"reference": "3e3d2ab01c7d8b484c18e6100ecf53639c744fa7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/pint/zipball/df105cf8ce7a8f0b8a9425ff45cd281a5448e423",
"reference": "df105cf8ce7a8f0b8a9425ff45cd281a5448e423",
"url": "https://api.github.com/repos/laravel/pint/zipball/3e3d2ab01c7d8b484c18e6100ecf53639c744fa7",
"reference": "3e3d2ab01c7d8b484c18e6100ecf53639c744fa7",
"shasum": ""
},
"require": {
@ -5841,13 +6148,13 @@
"php": "^8.1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.34.1",
"illuminate/view": "^10.26.2",
"laravel-zero/framework": "^10.1.2",
"friendsofphp/php-cs-fixer": "^3.38.0",
"illuminate/view": "^10.30.1",
"laravel-zero/framework": "^10.3.0",
"mockery/mockery": "^1.6.6",
"nunomaduro/larastan": "^2.6.4",
"nunomaduro/termwind": "^1.15.1",
"pestphp/pest": "^2.20.0"
"pestphp/pest": "^2.24.2"
},
"bin": [
"builds/pint"
@ -5883,7 +6190,7 @@
"issues": "https://github.com/laravel/pint/issues",
"source": "https://github.com/laravel/pint"
},
"time": "2023-10-26T09:26:10+00:00"
"time": "2023-11-07T17:59:57+00:00"
},
{
"name": "laravel/sail",

View File

@ -5,14 +5,10 @@ version: '3'
services:
app:
image: docker.io/bitnami/laravel:10
build:
dockerfile: ./Dockerfile
container_name: ${DOCKER_CONTAINER_NAME}
ports:
- '8000:8000'
volumes:
- './:/app'
networks:
- be-network
networks:
be-network:

11
docker-entrypoint.sh Executable file
View File

@ -0,0 +1,11 @@
source "$PWD/.env"
if [ ! -d "$PWD/vendor" ]; then
# vendor not exist.
composer i
else
# vendor exist.
composer u
fi
php artisan serve --host "0.0.0.0"

5
docker-php Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
source .env
echo "run artisan..."
docker exec -it "$DOCKER_CONTAINER_NAME" php "$@"

3
modules_statuses.json Normal file
View File

@ -0,0 +1,3 @@
{
"Auth": true
}

45
vite-module-loader.js Normal file
View File

@ -0,0 +1,45 @@
import fs from 'fs/promises';
import path from 'path';
async function collectModuleAssetsPaths(paths, modulesPath) {
modulesPath = path.join(__dirname, modulesPath);
const moduleStatusesPath = path.join(__dirname, 'modules_statuses.json');
try {
// Read module_statuses.json
const moduleStatusesContent = await fs.readFile(moduleStatusesPath, 'utf-8');
const moduleStatuses = JSON.parse(moduleStatusesContent);
// Read module directories
const moduleDirectories = await fs.readdir(modulesPath);
for (const moduleDir of moduleDirectories) {
if (moduleDir === '.DS_Store') {
// Skip .DS_Store directory
continue;
}
// Check if the module is enabled (status is true)
if (moduleStatuses[moduleDir] === true) {
const viteConfigPath = path.join(modulesPath, moduleDir, 'vite.config.js');
const stat = await fs.stat(viteConfigPath);
if (stat.isFile()) {
// Import the module-specific Vite configuration
const moduleConfig = await import(viteConfigPath);
if (moduleConfig.paths && Array.isArray(moduleConfig.paths)) {
paths.push(...moduleConfig.paths);
}
}
}
}
} catch (error) {
console.error(`Error reading module statuses or module configurations: ${error}`);
}
return paths;
}
export default collectModuleAssetsPaths;