Skip to content

Commit 74e1747

Browse files
committed
fix super-magic config
1 parent f75d38c commit 74e1747

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

backend/sandbox-gateway/app/services/sandbox_service.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,19 @@ async def _create_agent_container(self, sandbox_id: str) -> str:
312312
logger.warning(f"Agent环境文件{settings.agent_env_file_path}存在但未读取到任何环境变量")
313313

314314
# 创建并启动容器
315+
# 挂载配置文件,判断/app/config/config.yaml是否存在
316+
config_file_path = "/app/config/config.yaml"
317+
if os.path.exists(config_file_path):
318+
volumes = {
319+
config_file_path: {
320+
'bind': '/app/config/config.yaml',
321+
'mode': 'rw'
322+
}
323+
}
324+
else:
325+
volumes = {}
326+
327+
# 挂载配置文件
315328
container = self.docker_client.containers.run(
316329
self.image_name,
317330
detach=True,
@@ -321,7 +334,8 @@ async def _create_agent_container(self, sandbox_id: str) -> str:
321334
AGENT_LABEL: sandbox_id,
322335
SANDBOX_LABEL: sandbox_id
323336
},
324-
network=self.network_name # 使用与网关相同的网络
337+
network=self.network_name, # 使用与网关相同的网络
338+
volumes=volumes
325339
)
326340
logger.info(f"容器已创建: {container.name},使用网络: {self.network_name}")
327341

docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ services:
132132
volumes:
133133
- ./config/.env_super_magic:/app/.env.agent
134134
- /var/run/docker.sock:/var/run/docker.sock
135+
- ./config/config.yaml:/app/config/config.yaml
135136
env_file:
136137
- config/.env_sandbox_gateway
137138
networks:

0 commit comments

Comments
 (0)