Skip to content

Commit aee9412

Browse files
authored
Merge pull request #171 from CJackHwang/dev
Merge pull request #170 from hkfires/dev 增加docker内存限制相关配置
2 parents 171ff1c + c8edd43 commit aee9412

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

docker/.env.docker

Lines changed: 9 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,13 @@ USERSCRIPT_PATH=browser_utils/more_modles.js
118118
# Docker 特定配置
119119
# =============================================================================
120120

121+
# 容器内存限制
122+
# 默认不限制。如需限制容器资源,请在你的 .env 文件中取消注释并设置以下值。
123+
# 例如: DOCKER_MEMORY_LIMIT=1g或DOCKER_MEMORY_LIMIT=1024m
124+
# 注意:DOCKER_MEMORY_LIMIT和DOCKER_MEMSWAP_LIMIT相同时,不会使用SWAP
125+
# DOCKER_MEMORY_LIMIT=
126+
# DOCKER_MEMSWAP_LIMIT=
127+
121128
# 容器重启策略相关
122129
# 这些配置项在 docker-compose.yml 中使用
123130

docker/docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ services:
44
context: ..
55
dockerfile: docker/Dockerfile
66
container_name: ai-studio-proxy-container
7+
mem_limit: ${DOCKER_MEMORY_LIMIT:-0}
8+
memswap_limit: ${DOCKER_MEMSWAP_LIMIT:-0}
79
ports:
8-
- "${HOST_FASTAPI_PORT:-8080}:${DEFAULT_FASTAPI_PORT:-2048}"
9-
- "${HOST_STREAM_PORT:-8081}:${STREAM_PORT:-3120}"
10+
- "${HOST_FASTAPI_PORT:-2048}:${DEFAULT_FASTAPI_PORT:-2048}"
11+
- "${HOST_STREAM_PORT:-3120}:${STREAM_PORT:-3120}"
1012
volumes:
1113
# 挂载认证文件目录 (必需)
1214
- ../auth_profiles:/app/auth_profiles

0 commit comments

Comments
 (0)