fix: 修复 Docker Compose v2 严格类型下 cpus 双引号导致 ParseFloat 报错
This commit is contained in:
+6
-4
@@ -55,16 +55,18 @@ services:
|
||||
# ===== 日志/性能 =====
|
||||
NODE_OPTIONS: ${NODE_OPTIONS:-"--max-old-space-size=768"}
|
||||
# 2C4G 机器的推荐配置(.env 可覆盖);小机器 1C2G 也能跑
|
||||
# ⚠️ 注意:cpus 默认值不能加双引号!新版 Docker Compose v2 严格类型:
|
||||
# 加引号会解析为字符串 '"1.5"' → ParseFloat 失败报错
|
||||
mem_limit: ${APP_MEM_LIMIT:-1400m}
|
||||
mem_reservation: ${APP_MEM_RESERVATION:-384m}
|
||||
cpus: ${APP_CPUS:-"1.5"}
|
||||
cpus: ${APP_CPUS:-1.5}
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: ${APP_CPUS_LIMIT:-"2"}
|
||||
cpus: ${APP_CPUS_LIMIT:-2}
|
||||
memory: ${APP_MEM_LIMIT:-1400M}
|
||||
reservations:
|
||||
cpus: ${APP_CPUS_RESERVATION:-"0.5"}
|
||||
cpus: ${APP_CPUS_RESERVATION:-0.5}
|
||||
memory: ${APP_MEM_RESERVATION:-384M}
|
||||
healthcheck:
|
||||
# 30s 后开始检查,每 15s 一次,连续 3 次失败就重启
|
||||
@@ -141,7 +143,7 @@ services:
|
||||
- redis-data:/data
|
||||
mem_limit: ${REDIS_MEM_LIMIT:-384m}
|
||||
mem_reservation: ${REDIS_MEM_RESERVATION:-64m}
|
||||
cpus: ${REDIS_CPUS:-"0.5"}
|
||||
cpus: ${REDIS_CPUS:-0.5}
|
||||
networks:
|
||||
- voicehub-net
|
||||
|
||||
|
||||
Reference in New Issue
Block a user