Skip to content

Commit f567860

Browse files
committed
Move some docker configuration out of docker module.
1 parent 34f9a24 commit f567860

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

src/docker.rs

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use dirs::{CARGO_HOME, RUSTUP_HOME};
21
use errors::*;
32
use run;
43
use std::env;
@@ -55,23 +54,7 @@ pub struct ContainerConfig<'a> {
5554
}
5655

5756

58-
pub fn run(source_path: &Path, target_path: &Path, args: &[&str]) -> Result<()> {
59-
60-
info!("running: {}", args.join(" "));
61-
62-
let env = RustEnv {
63-
args: args,
64-
work_dir: (source_path.into(), Perm::ReadOnly),
65-
cargo_home: (Path::new(CARGO_HOME).into(), Perm::ReadOnly),
66-
rustup_home: (Path::new(RUSTUP_HOME).into(), Perm::ReadOnly),
67-
// This is configured as CARGO_TARGET_DIR by the docker container itself
68-
target_dir: (target_path.into(), Perm::ReadWrite),
69-
};
70-
71-
run_container(rust_container(env))
72-
}
73-
74-
pub fn run_container(config: ContainerConfig) -> Result<()> {
57+
pub fn run(config: ContainerConfig) -> Result<()> {
7558
let c = Container::create_container(config)?;
7659
defer!{{
7760
if let Err(e) = c.delete() {

src/toolchain.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,15 @@ impl Toolchain {
216216
let mut full_args = vec!["cargo", &*toolchain_arg];
217217
full_args.extend_from_slice(args);
218218

219-
docker::run(source_dir, &ex_target_dir, &full_args)
219+
info!("running: {}", full_args.join(" "));
220+
let rust_env = docker::RustEnv {
221+
args: &full_args,
222+
work_dir: (source_dir.into(), docker::Perm::ReadOnly),
223+
cargo_home: (Path::new(CARGO_HOME).into(), docker::Perm::ReadOnly),
224+
rustup_home: (Path::new(RUSTUP_HOME).into(), docker::Perm::ReadOnly),
225+
// This is configured as CARGO_TARGET_DIR by the docker container itself
226+
target_dir: (ex_target_dir, docker::Perm::ReadWrite),
227+
};
228+
docker::run(docker::rust_container(rust_env))
220229
}
221230
}

0 commit comments

Comments
 (0)