aboutsummaryrefslogtreecommitdiff
path: root/planetwars-matchrunner/src/bin/testmatch.rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-01-20 20:30:56 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2022-01-20 20:30:56 +0100
commitc569070d5c2b0a2a9f33640d76d232c1a967e671 (patch)
treeb0b07a2128213a1560d3b687d83035bb97ccba9c /planetwars-matchrunner/src/bin/testmatch.rs
parent5f1c7385c757b625e10e2bbae432e9fa9efce6b5 (diff)
downloadplanetwars.dev-c569070d5c2b0a2a9f33640d76d232c1a967e671.tar.xz
planetwars.dev-c569070d5c2b0a2a9f33640d76d232c1a967e671.zip
mount a code bundle into executor container
Diffstat (limited to 'planetwars-matchrunner/src/bin/testmatch.rs')
-rw-r--r--planetwars-matchrunner/src/bin/testmatch.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/planetwars-matchrunner/src/bin/testmatch.rs b/planetwars-matchrunner/src/bin/testmatch.rs
index ebd0199..9a5c214 100644
--- a/planetwars-matchrunner/src/bin/testmatch.rs
+++ b/planetwars-matchrunner/src/bin/testmatch.rs
@@ -17,12 +17,11 @@ use planetwars_matchrunner::{
pw_match, MatchConfig, MatchMeta, PlayerInfo,
};
use planetwars_rules::protocol as proto;
-use planetwars_rules::PwConfig;
use std::env;
use tokio::io::{AsyncWrite, AsyncWriteExt};
use tokio::sync::mpsc;
-const IMAGE: &'static str = "simplebot:latest";
+const IMAGE: &'static str = "python:3.10-slim-buster";
#[tokio::main]
async fn main() {
@@ -38,8 +37,13 @@ async fn _run_match(map_path: String) {
}
async fn create_player_process(docker: &Docker) -> Result<(), bollard::errors::Error> {
+ let bot_code_dir = "../simplebot";
let config = container::Config {
image: Some(IMAGE),
+ host_config: Some(container::HostConfig {
+ binds: Some(vec![format!("{}:{}", bot_code_dir, "/workdir")]),
+ ..Default::default()
+ }),
..Default::default()
};
@@ -57,6 +61,7 @@ async fn create_player_process(docker: &Docker) -> Result<(), bollard::errors::E
attach_stdin: Some(true),
attach_stdout: Some(true),
attach_stderr: Some(true),
+ working_dir: Some("/workdir"),
cmd: Some(vec!["python", "simplebot.py"]),
..Default::default()
},