Skip to content

Commit 2d644a0

Browse files
committed
Require dockerfile to be specified relative to cargo workspace root
1 parent d3e2f33 commit 2d644a0

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/docker/custom.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ impl<'a> Dockerfile<'a> {
120120
}
121121

122122
let path = match self {
123-
Dockerfile::File { path, .. } => PathBuf::from(path),
123+
Dockerfile::File { path, .. } => {
124+
paths.metadata.workspace_root.join(PathBuf::from(path))
125+
}
124126
Dockerfile::Custom { content, .. } => {
125127
let target_dir = paths
126128
.metadata
@@ -147,10 +149,6 @@ impl<'a> Dockerfile<'a> {
147149
}
148150
}
149151

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

156154
if let Some(build_opts) = options.config.build_opts() {

0 commit comments

Comments
 (0)