From 2d644a0b93db94ef98abf1ccb2dac8b034ce8bfd Mon Sep 17 00:00:00 2001 From: Krzysztof Zduniak Date: Tue, 15 Oct 2024 09:13:32 +0200 Subject: [PATCH] Require dockerfile to be specified relative to cargo workspace root --- src/docker/custom.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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() {