This commit is contained in:
2025-10-22 11:24:22 +08:00
parent 42e1a55993
commit 7c2ee6652e

View File

@@ -73,13 +73,16 @@ def prepare_user(spawner: Spawner):
# 4. 挂载该用户该看的资源(只读)
shared = user_dir / "shared"
shared.mkdir(exist_ok=True)
bind_list = [] # 先攒列表
for grp_name in user_groups:
for res in res_map.get(grp_name, []):
res_path = SHARED_ROOT / res
if res_path.is_dir():
spawner.volumes[str(res_path)] = {
'bind': str(shared / res),
'mode': 'ro' # 重启即还原
}
bind_list.append({
'source': str(res_path),
'target': str(shared / res),
'read-only': True,
})
spawner.bind_mounts = bind_list
c.Spawner.pre_spawn_hook = prepare_user