1234567891011121314151617 |
- version: '3'
- services:
- log-server:
- build: .
- ports:
- - "3006:3006" # 将容器的 3000 端口映射到主机的 3000 端口
- container_name: log-server
- environment:
- - NODE_ENV=production
- deploy:
- replicas: 4 # 启动 4 个副本,增加并发处理能力
- resources:
- limits:
- cpus: "1.0" # 每个容器最多使用 1 个 CPU 核心
- memory: 1G # 每个容器最多使用 1GB 内存
- restart: always # 容器崩溃后自动重启
|