| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- version: '3.8'
- services:
- mall4j-browserless:
- image: registry.cn-hongkong.aliyuncs.com/mall4j-images/browserless:v2.31.1
- container_name: mall4j-browserless
- ports:
- - '3000:3000'
- restart: always
- environment:
- # 根据机器资源设置,若 CPU 有 4核、内存大于 4G,可配置为4提高并发
- - MAX_CONCURRENT_SESSIONS=1
- - PREBOOT_CHROME=true
- - TIMEOUT=600000
- # 设置 mall4j-browserless 容器的 CONNECTION_TIMEOUT(可选)
- # - CONNECTION_TIMEOUT=60000
- healthcheck:
- test: ["CMD", "curl", "-f", "http://localhost:3000"]
- interval: 30s
- timeout: 10s
- retries: 3
- mall4j-renderer:
- image: node:18-slim
- container_name: mall4j-renderer
- working_dir: /app
- ports:
- - '4000:4000'
- volumes:
- - ./:/app
- - /app/node_modules
- restart: always
- command: >
- sh -c "if [ -f yarn.lock ]; then
- yarn install --frozen-lockfile;
- else
- yarn install;
- fi &&
- yarn start"
- environment:
- - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
- - BROWSER_WS_ENDPOINT=ws://mall4j-browserless:3000
- # 根据机器资源设置
- - MAX_CONCURRENCY=8
- - RENDER_TIMEOUT_MS=15000
- depends_on:
- - mall4j-browserless
- healthcheck:
- test: ["CMD", "curl", "-f", "http://localhost:4000/healthz"]
- interval: 30s
- timeout: 10s
- retries: 3
|