|
|
@@ -1,29 +1,55 @@
|
|
|
services:
|
|
|
- filament_admin:
|
|
|
+ # 主应用(Web API 服务)
|
|
|
+ app:
|
|
|
build: .
|
|
|
- container_name: filament_admin
|
|
|
+ container_name: math_cms_app
|
|
|
command: php artisan serve --host=0.0.0.0 --port=8000
|
|
|
ports:
|
|
|
- "5019:8000"
|
|
|
env_file:
|
|
|
- .env
|
|
|
volumes:
|
|
|
- # 持久化存储
|
|
|
- - ./storage:/app/storage
|
|
|
- - ./database:/app/database
|
|
|
- networks:
|
|
|
- - default
|
|
|
- - laradock_backend
|
|
|
+ - ./storage:/app/storage # 日志 + 临时文件 + OCR上传
|
|
|
restart: unless-stopped
|
|
|
healthcheck:
|
|
|
- test: ["CMD-SHELL", "php artisan --version || exit 1"]
|
|
|
+ test: ["CMD-SHELL", "curl -f http://localhost:8000/health || exit 1"]
|
|
|
interval: 30s
|
|
|
timeout: 10s
|
|
|
retries: 3
|
|
|
start_period: 40s
|
|
|
|
|
|
+ # 队列 Worker(通用任务队列)
|
|
|
+ queue:
|
|
|
+ build: .
|
|
|
+ container_name: math_cms_queue
|
|
|
+ command: php artisan queue:work --sleep=3 --tries=3 --max-time=3600
|
|
|
+ env_file:
|
|
|
+ - .env
|
|
|
+ volumes:
|
|
|
+ - ./storage:/app/storage
|
|
|
+ restart: unless-stopped
|
|
|
+ deploy:
|
|
|
+ resources:
|
|
|
+ limits:
|
|
|
+ cpus: '1'
|
|
|
+ memory: 512M
|
|
|
+
|
|
|
+ # PDF 生成专用 Worker(资源隔离,防止 Chrome 吃满 CPU)
|
|
|
+ pdf-worker:
|
|
|
+ build: .
|
|
|
+ container_name: math_cms_pdf
|
|
|
+ command: php artisan queue:work --queue=pdf --sleep=3 --tries=2 --max-time=300 --max-jobs=10
|
|
|
+ env_file:
|
|
|
+ - .env
|
|
|
+ volumes:
|
|
|
+ - ./storage:/app/storage
|
|
|
+ restart: unless-stopped
|
|
|
+ deploy:
|
|
|
+ resources:
|
|
|
+ limits:
|
|
|
+ cpus: '2'
|
|
|
+ memory: 2G
|
|
|
+
|
|
|
networks:
|
|
|
default:
|
|
|
driver: bridge
|
|
|
- laradock_backend:
|
|
|
- external: true
|