diff --git a/.changes/1574.json b/.changes/1574.json new file mode 100644 index 000000000..5ffd5e7c9 --- /dev/null +++ b/.changes/1574.json @@ -0,0 +1,4 @@ +{ + "type": "fixed", + "description": "`dockerfile` path is now relative to cargo workspace root" +} diff --git a/src/docker/custom.rs b/src/docker/custom.rs index a58b2370c..4e2a4245e 100644 --- a/src/docker/custom.rs +++ b/src/docker/custom.rs @@ -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 @@ -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() {