| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- services:
- # 主应用(Web API 服务)- 用于渲染 HTML
- app:
- build: .
- container_name: math_cms_app
- ports:
- - "8000:8000"
- env_file:
- - .env
- volumes:
- - ./storage:/app/storage
- - ./.env:/app/.env
- restart: unless-stopped
- healthcheck:
- test: ["CMD-SHELL", "curl -f http://localhost:8000/health || exit 1"]
- interval: 30s
- timeout: 10s
- retries: 3
- start_period: 40s
- # PDF Worker 1
- pdf-worker-1:
- build: .
- container_name: pdf_worker_1
- command: php artisan queue:work --queue=pdf --sleep=3 --tries=3 --max-time=300 --max-jobs=10
- env_file:
- - .env
- volumes:
- - ./storage:/app/storage
- - ./.env:/app/.env
- restart: unless-stopped
- depends_on:
- app:
- condition: service_healthy
- healthcheck:
- test: ["CMD-SHELL", "pgrep -f 'queue:work' || exit 1"]
- interval: 30s
- timeout: 10s
- retries: 3
- start_period: 10s
- deploy:
- resources:
- limits:
- cpus: '1'
- memory: 1536M
- # PDF Worker 2
- pdf-worker-2:
- build: .
- container_name: pdf_worker_2
- command: php artisan queue:work --queue=pdf --sleep=3 --tries=3 --max-time=300 --max-jobs=10
- env_file:
- - .env
- volumes:
- - ./storage:/app/storage
- - ./.env:/app/.env
- restart: unless-stopped
- depends_on:
- app:
- condition: service_healthy
- healthcheck:
- test: ["CMD-SHELL", "pgrep -f 'queue:work' || exit 1"]
- interval: 30s
- timeout: 10s
- retries: 3
- start_period: 10s
- deploy:
- resources:
- limits:
- cpus: '1'
- memory: 1536M
- # PDF Worker 3
- pdf-worker-3:
- build: .
- container_name: pdf_worker_3
- command: php artisan queue:work --queue=pdf --sleep=3 --tries=3 --max-time=300 --max-jobs=10
- env_file:
- - .env
- volumes:
- - ./storage:/app/storage
- - ./.env:/app/.env
- restart: unless-stopped
- depends_on:
- app:
- condition: service_healthy
- healthcheck:
- test: ["CMD-SHELL", "pgrep -f 'queue:work' || exit 1"]
- interval: 30s
- timeout: 10s
- retries: 3
- start_period: 10s
- deploy:
- resources:
- limits:
- cpus: '1'
- memory: 1536M
- # PDF Worker 4
- pdf-worker-4:
- build: .
- container_name: pdf_worker_4
- command: php artisan queue:work --queue=pdf --sleep=3 --tries=3 --max-time=300 --max-jobs=10
- env_file:
- - .env
- volumes:
- - ./storage:/app/storage
- - ./.env:/app/.env
- restart: unless-stopped
- depends_on:
- app:
- condition: service_healthy
- healthcheck:
- test: ["CMD-SHELL", "pgrep -f 'queue:work' || exit 1"]
- interval: 30s
- timeout: 10s
- retries: 3
- start_period: 10s
- deploy:
- resources:
- limits:
- cpus: '1'
- memory: 1536M
- networks:
- default:
- driver: bridge
|