Skip to content

Commit df3a5ae

Browse files
committed
Add persistent cache volume for challenge datasets
Mount /root/.cache as a named Docker volume so downloaded task datasets persist across container restarts.
1 parent a467f75 commit df3a5ae

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

crates/challenge-orchestrator/src/docker.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ impl DockerClient {
462462
// Use container_name (includes validator suffix) so each validator has its own data
463463
let volume_name = format!("{}-data", container_name);
464464

465-
// Create volume if it doesn't exist (Docker will auto-create on mount, but explicit is clearer)
465+
// Create volumes if they don't exist (Docker will auto-create on mount, but explicit is clearer)
466466
let volume_opts = bollard::volume::CreateVolumeOptions {
467467
name: volume_name.as_str(),
468468
driver: "local",
@@ -473,6 +473,17 @@ impl DockerClient {
473473
debug!("Volume creation result for {}: {:?}", volume_name, e);
474474
}
475475

476+
// Create cache volume for downloaded datasets
477+
let cache_volume_name = format!("{}-cache", volume_name);
478+
let cache_volume_opts = bollard::volume::CreateVolumeOptions {
479+
name: cache_volume_name.as_str(),
480+
driver: "local",
481+
..Default::default()
482+
};
483+
if let Err(e) = self.docker.create_volume(cache_volume_opts).await {
484+
debug!("Volume creation result for {}: {:?}", cache_volume_name, e);
485+
}
486+
476487
// Build host config with resource limits
477488
let mut host_config = HostConfig {
478489
network_mode: Some(self.network_name.clone()),
@@ -487,6 +498,7 @@ impl DockerClient {
487498
"/tmp/platform-tasks:/app/data/tasks:rw".to_string(), // Override internal tasks
488499
"/tmp/platform-tasks:/tmp/platform-tasks:rw".to_string(), // For DinD path mapping
489500
format!("{}:/data:rw", volume_name), // Named volume for persistent state
501+
format!("{}-cache:/root/.cache:rw", volume_name), // Cache for downloaded datasets
490502
]),
491503
..Default::default()
492504
};

0 commit comments

Comments
 (0)