feat: add configurable volume mode for Docker volumes in env.py (#537)

* feat: Add configurable volume mode for Docker volumes in env.py

* fix: Change default extra_volume_mode to read-only in DockerConf
This commit is contained in:
you-n-g
2025-01-24 14:08:38 +08:00
committed by GitHub
parent 6ec56a3f6c
commit 92bc51bf42
+3 -2
View File
@@ -134,6 +134,7 @@ class DockerConf(ExtendedBaseSettings):
default_entry: str # the entry point of the image
extra_volumes: dict = {}
extra_volume_mode: str = "ro" # by default. only the mount_path should be writable, others are changed to read-only
# Sometime, we need maintain some extra data for the workspace.
# And the extra data may be shared and the downloading can be time consuming.
# So we just want to download it once.
@@ -345,10 +346,10 @@ class DockerEnv(Env[DockerConf]):
volumns[local_path] = {"bind": self.conf.mount_path, "mode": "rw"}
if self.conf.extra_volumes is not None:
for lp, rp in self.conf.extra_volumes.items():
volumns[lp] = {"bind": rp, "mode": "rw"}
volumns[lp] = {"bind": rp, "mode": self.conf.extra_volume_mode}
if running_extra_volume is not None:
for lp, rp in running_extra_volume.items():
volumns[lp] = {"bind": rp, "mode": "rw"}
volumns[lp] = {"bind": rp, "mode": self.conf.extra_volume_mode}
log_output = ""