Skip to content

Commit 8681b7b

Browse files
committed
增加docker内存限制相关配置
1 parent 153c200 commit 8681b7b

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

docker/.env.docker

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
# =============================================================================
77

88
# 主机上映射的端口 (外部访问端口)
9-
HOST_FASTAPI_PORT=8080
10-
HOST_STREAM_PORT=8081
9+
HOST_FASTAPI_PORT=2048
10+
HOST_STREAM_PORT=3120
1111

1212
# =============================================================================
1313
# 容器内服务端口配置
@@ -118,6 +118,12 @@ USERSCRIPT_PATH=browser_utils/more_modles.js
118118
# Docker 特定配置
119119
# =============================================================================
120120

121+
# 容器资源限制 (可选)
122+
# 默认不限制。如需限制容器资源,请在你的 .env 文件中取消注释并设置以下值。
123+
# 例如: DOCKER_MEMORY_LIMIT=4g
124+
# DOCKER_MEMORY_LIMIT=
125+
# DOCKER_MEMSWAP_LIMIT=
126+
121127
# 容器重启策略相关
122128
# 这些配置项在 docker-compose.yml 中使用
123129

docker/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ services:
44
context: ..
55
dockerfile: docker/Dockerfile
66
container_name: ai-studio-proxy-container
7+
mem_limit: ${DOCKER_MEMORY_LIMIT}
8+
memswap_limit: ${DOCKER_MEMSWAP_LIMIT}
79
ports:
810
- "${HOST_FASTAPI_PORT:-8080}:${DEFAULT_FASTAPI_PORT:-2048}"
911
- "${HOST_STREAM_PORT:-8081}:${STREAM_PORT:-3120}"

0 commit comments

Comments
 (0)