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