From c569070d5c2b0a2a9f33640d76d232c1a967e671 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Thu, 20 Jan 2022 20:30:56 +0100 Subject: mount a code bundle into executor container --- planetwars-matchrunner/src/bin/testmatch.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'planetwars-matchrunner/src/bin') 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() }, -- cgit v1.2.3