docker-compose.pdf.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. services:
  2. # 主应用(Web API 服务)- 用于渲染 HTML
  3. app:
  4. build: .
  5. container_name: math_cms_app
  6. ports:
  7. - "8000:8000"
  8. env_file:
  9. - .env
  10. volumes:
  11. - ./storage:/app/storage
  12. - ./.env:/app/.env
  13. restart: unless-stopped
  14. healthcheck:
  15. test: ["CMD-SHELL", "curl -f http://localhost:8000/health || exit 1"]
  16. interval: 30s
  17. timeout: 10s
  18. retries: 3
  19. start_period: 40s
  20. # PDF Worker 1
  21. pdf-worker-1:
  22. build: .
  23. container_name: pdf_worker_1
  24. command: php artisan queue:work --queue=pdf --sleep=3 --tries=3 --max-time=300 --max-jobs=10
  25. env_file:
  26. - .env
  27. volumes:
  28. - ./storage:/app/storage
  29. - ./.env:/app/.env
  30. restart: unless-stopped
  31. depends_on:
  32. app:
  33. condition: service_healthy
  34. healthcheck:
  35. test: ["CMD-SHELL", "pgrep -f 'queue:work' || exit 1"]
  36. interval: 30s
  37. timeout: 10s
  38. retries: 3
  39. start_period: 10s
  40. deploy:
  41. resources:
  42. limits:
  43. cpus: '1'
  44. memory: 1536M
  45. # PDF Worker 2
  46. pdf-worker-2:
  47. build: .
  48. container_name: pdf_worker_2
  49. command: php artisan queue:work --queue=pdf --sleep=3 --tries=3 --max-time=300 --max-jobs=10
  50. env_file:
  51. - .env
  52. volumes:
  53. - ./storage:/app/storage
  54. - ./.env:/app/.env
  55. restart: unless-stopped
  56. depends_on:
  57. app:
  58. condition: service_healthy
  59. healthcheck:
  60. test: ["CMD-SHELL", "pgrep -f 'queue:work' || exit 1"]
  61. interval: 30s
  62. timeout: 10s
  63. retries: 3
  64. start_period: 10s
  65. deploy:
  66. resources:
  67. limits:
  68. cpus: '1'
  69. memory: 1536M
  70. # PDF Worker 3
  71. pdf-worker-3:
  72. build: .
  73. container_name: pdf_worker_3
  74. command: php artisan queue:work --queue=pdf --sleep=3 --tries=3 --max-time=300 --max-jobs=10
  75. env_file:
  76. - .env
  77. volumes:
  78. - ./storage:/app/storage
  79. - ./.env:/app/.env
  80. restart: unless-stopped
  81. depends_on:
  82. app:
  83. condition: service_healthy
  84. healthcheck:
  85. test: ["CMD-SHELL", "pgrep -f 'queue:work' || exit 1"]
  86. interval: 30s
  87. timeout: 10s
  88. retries: 3
  89. start_period: 10s
  90. deploy:
  91. resources:
  92. limits:
  93. cpus: '1'
  94. memory: 1536M
  95. # PDF Worker 4
  96. pdf-worker-4:
  97. build: .
  98. container_name: pdf_worker_4
  99. command: php artisan queue:work --queue=pdf --sleep=3 --tries=3 --max-time=300 --max-jobs=10
  100. env_file:
  101. - .env
  102. volumes:
  103. - ./storage:/app/storage
  104. - ./.env:/app/.env
  105. restart: unless-stopped
  106. depends_on:
  107. app:
  108. condition: service_healthy
  109. healthcheck:
  110. test: ["CMD-SHELL", "pgrep -f 'queue:work' || exit 1"]
  111. interval: 30s
  112. timeout: 10s
  113. retries: 3
  114. start_period: 10s
  115. deploy:
  116. resources:
  117. limits:
  118. cpus: '1'
  119. memory: 1536M
  120. networks:
  121. default:
  122. driver: bridge