Run tmux containers with host user mounts
This commit is contained in:
@@ -3354,21 +3354,64 @@ def build_container_command(
|
||||
instance: str,
|
||||
) -> str:
|
||||
tool_root = config.tools_root
|
||||
rv_script = tool_root / "rv"
|
||||
if not rv_script.is_file():
|
||||
compose_file = tool_root / "docker-compose.yml"
|
||||
if not (tool_root / "rv").is_file():
|
||||
candidates = "\n".join(f" - {path}" for path in config.tools_root_candidates)
|
||||
raise SystemExit(f"Missing rv launcher. Checked:\n{candidates}")
|
||||
if not compose_file.is_file():
|
||||
raise SystemExit(f"Missing docker compose file: {compose_file}")
|
||||
|
||||
home_dir = Path(os.environ.get("HOME") or str(Path.home()))
|
||||
card_path_text = str(card_path)
|
||||
env_parts = [
|
||||
f"WORKSPACE_ROOT={shlex.quote(str(config.workspace_root))}",
|
||||
f"RV_CARDS_ROOT={shlex.quote(str(config.series_root))}",
|
||||
"RV_PROFILE=rv32i",
|
||||
f"RV_REPO={shlex.quote(card_path_text)}",
|
||||
f"RV_REPO_PATH={shlex.quote(str(card_path))}",
|
||||
f"RV_REPO_HOST={shlex.quote(str(card_path))}",
|
||||
f"RV_CARD={shlex.quote(selector)}",
|
||||
f"RV_INSTANCE={shlex.quote(instance)}",
|
||||
"RV_CODEX=0",
|
||||
]
|
||||
compose_args = [
|
||||
"docker",
|
||||
"compose",
|
||||
"-f",
|
||||
str(compose_file),
|
||||
"run",
|
||||
"--rm",
|
||||
"--user",
|
||||
f"{os.getuid()}:{os.getgid()}",
|
||||
"--workdir",
|
||||
card_path_text,
|
||||
"-e",
|
||||
f"HOME={home_dir}",
|
||||
"-e",
|
||||
f"RV_REPO={card_path_text}",
|
||||
"-e",
|
||||
f"WORKSPACE_ROOT={config.workspace_root}",
|
||||
"-e",
|
||||
f"RV_CARDS_ROOT={config.series_root}",
|
||||
"-e",
|
||||
f"RV_REPO_PATH={card_path_text}",
|
||||
"-e",
|
||||
f"RV_REPO_HOST={card_path_text}",
|
||||
"-e",
|
||||
f"RV_CARD={selector}",
|
||||
"-e",
|
||||
f"RV_INSTANCE={instance}",
|
||||
"-e",
|
||||
"RV_CODEX=0",
|
||||
"-v",
|
||||
f"{card_path_text}:{card_path_text}",
|
||||
"env",
|
||||
"shell",
|
||||
]
|
||||
return " && ".join(
|
||||
[
|
||||
f"cd {shlex.quote(str(tool_root))}",
|
||||
" ".join(env_parts + ["bash", "./rv", "shell"]),
|
||||
" ".join(env_parts + [shlex.join(compose_args)]),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user