Skip to content

Commit 1b5463b

Browse files
committed
feat: add persistent data volume for challenge containers
Mount /tmp/platform-challenges/{container}/data to /data in challenge containers. This allows challenges to persist state (evaluation progress, etc.) across: - Container restarts - Image repulls - Validator restarts Each challenge+validator combination gets its own persistent directory.
1 parent 3b9f9f2 commit 1b5463b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

crates/challenge-orchestrator/src/docker.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ impl DockerClient {
301301
}]),
302302
);
303303

304+
// Create persistent data directory for challenge state (survives restarts)
305+
let challenge_data_dir = format!("/tmp/platform-challenges/{}/data", container_name);
306+
if let Err(e) = std::fs::create_dir_all(&challenge_data_dir) {
307+
warn!("Failed to create challenge data dir {}: {}", challenge_data_dir, e);
308+
}
309+
304310
// Build host config with resource limits
305311
let mut host_config = HostConfig {
306312
network_mode: Some(self.network_name.clone()),
@@ -309,10 +315,12 @@ impl DockerClient {
309315
memory: Some((config.memory_mb * 1024 * 1024) as i64),
310316
// Mount Docker socket for challenge containers to run agent evaluations
311317
// Mount tasks directory both to internal path AND to host path for Docker-in-Docker
318+
// Mount persistent data directory for challenge state (evaluation progress, etc.)
312319
binds: Some(vec![
313320
"/var/run/docker.sock:/var/run/docker.sock:rw".to_string(),
314321
"/tmp/platform-tasks:/app/data/tasks:rw".to_string(), // Override internal tasks
315322
"/tmp/platform-tasks:/tmp/platform-tasks:rw".to_string(), // For DinD path mapping
323+
format!("{}:/data:rw", challenge_data_dir), // Persistent challenge state
316324
]),
317325
..Default::default()
318326
};

0 commit comments

Comments
 (0)