Skip to content

Commit 7c66062

Browse files
committed
build without sudo
1 parent 8f44634 commit 7c66062

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

neurodocker/reproenv/tests/utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,18 @@ def build_singularity_image(context: Path, remove=True) -> Generator[str, None,
105105
cachedir = Path("/") / "dev" / "shm" / user / "apptainer"
106106
singularity = os.environ.get("REPROENV_APPTAINER_PROGRAM", "apptainer")
107107
cmd: list[str] = [
108-
"sudo",
109-
f"APPTAINER_CACHEDIR={cachedir}",
110108
singularity,
111109
"build",
110+
"--fakeroot",
112111
str(sif),
113112
str(recipe),
114113
]
114+
env: dict[str, str] = {
115+
"APPTAINER_CACHEDIR": cachedir,
116+
"PATH": os.environ.get("PATH"),
117+
}
115118
try:
116-
_ = subprocess.check_output(cmd, cwd=context)
119+
_ = subprocess.check_output(cmd, env=env, cwd=context)
117120
yield str(sif)
118121
finally:
119122
if remove:

0 commit comments

Comments
 (0)