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

feat(docker-build): pass additional workspace directory #1690

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
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
14 changes: 13 additions & 1 deletion crates/build/src/command/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,19 @@ pub(crate) fn create_docker_command(
.expect("Failed to canonicalize program directory")
.try_into()
.unwrap();
let workspace_root = &program_metadata.workspace_root;

let workspace_root: &Utf8PathBuf = &args
.workspace_directory
.as_deref()
.map(|workspace_path| {
std::path::Path::new(workspace_path)
.to_path_buf()
.canonicalize()
.expect("Failed to canonicalize workspace directory")
.try_into()
.unwrap()
})
.unwrap_or_else(|| program_metadata.workspace_root.clone());

// Check if docker is installed and running.
let docker_check = Command::new("docker")
Expand Down
9 changes: 9 additions & 0 deletions crates/build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ pub struct BuildArgs {
default_value = DEFAULT_OUTPUT_DIR
)]
pub output_directory: String,
#[clap(
alias = "workspace-dir",
long,
action,
help = "Optional workspace directory to be used",
default_value = None
)]
pub workspace_directory: Option<String>,
}

// Implement default args to match clap defaults.
Expand All @@ -84,6 +92,7 @@ impl Default for BuildArgs {
output_directory: DEFAULT_OUTPUT_DIR.to_string(),
locked: false,
no_default_features: false,
workspace_directory: None,
}
}
}
Expand Down
Loading