Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow mount_path to be specified when defining volumes. #540

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,16 @@ pub fn run(target: &Target,
validate_env_var(var)?;

if let Ok(val) = env::var(var) {
let host_path = Path::new(&val).canonicalize()?;
let mount_path = &host_path;

let path_parts: Vec<&str> = val.split(':').collect();
let host_path = Path::new(&path_parts[0]).canonicalize()?;

let mount_path = if path_parts.len() > 1 {
PathBuf::from(&path_parts[1])
} else {
host_path.clone()
};

docker.args(&["-v", &format!("{}:{}", host_path.display(), mount_path.display())]);
docker.args(&["-e", &format!("{}={}", var, mount_path.display())]);
}
Expand Down