Skip to content

Commit

Permalink
Require dockerfile to be specified relative to cargo workspace root
Browse files Browse the repository at this point in the history
  • Loading branch information
ziutech committed Oct 15, 2024
1 parent d3e2f33 commit 2d644a0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/docker/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ impl<'a> Dockerfile<'a> {
}

let path = match self {
Dockerfile::File { path, .. } => PathBuf::from(path),
Dockerfile::File { path, .. } => {
paths.metadata.workspace_root.join(PathBuf::from(path))
}
Dockerfile::Custom { content, .. } => {
let target_dir = paths
.metadata
Expand All @@ -147,10 +149,6 @@ impl<'a> Dockerfile<'a> {
}
}

// note that this is always relative to the PWD: if we have
// `$workspace_root/Dockerfile`, then running a build
// `PWD=$workspace_root/src/ cross build` would require
// the Dockerfile path to be specified as `../Dockerfile`.
docker_build.args(["--file".into(), path]);

if let Some(build_opts) = options.config.build_opts() {
Expand Down

0 comments on commit 2d644a0

Please sign in to comment.