docker-compose.yaml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. version: '3.8'
  2. services:
  3. mall4j-browserless:
  4. image: registry.cn-hongkong.aliyuncs.com/mall4j-images/browserless:v2.31.1
  5. container_name: mall4j-browserless
  6. ports:
  7. - '3000:3000'
  8. restart: always
  9. environment:
  10. # 根据机器资源设置,若 CPU 有 4核、内存大于 4G,可配置为4提高并发
  11. - MAX_CONCURRENT_SESSIONS=1
  12. - PREBOOT_CHROME=true
  13. - TIMEOUT=600000
  14. # 设置 mall4j-browserless 容器的 CONNECTION_TIMEOUT(可选)
  15. # - CONNECTION_TIMEOUT=60000
  16. healthcheck:
  17. test: ["CMD", "curl", "-f", "http://localhost:3000"]
  18. interval: 30s
  19. timeout: 10s
  20. retries: 3
  21. mall4j-renderer:
  22. image: node:18-slim
  23. container_name: mall4j-renderer
  24. working_dir: /app
  25. ports:
  26. - '4000:4000'
  27. volumes:
  28. - ./:/app
  29. - /app/node_modules
  30. restart: always
  31. command: >
  32. sh -c "if [ -f yarn.lock ]; then
  33. yarn install --frozen-lockfile;
  34. else
  35. yarn install;
  36. fi &&
  37. yarn start"
  38. environment:
  39. - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
  40. - BROWSER_WS_ENDPOINT=ws://mall4j-browserless:3000
  41. # 根据机器资源设置
  42. - MAX_CONCURRENCY=8
  43. - RENDER_TIMEOUT_MS=15000
  44. depends_on:
  45. - mall4j-browserless
  46. healthcheck:
  47. test: ["CMD", "curl", "-f", "http://localhost:4000/healthz"]
  48. interval: 30s
  49. timeout: 10s
  50. retries: 3