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

Require dockerfile to be specified relative to cargo workspace root #1574

Merged
merged 2 commits into from
Oct 15, 2024
Merged
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
4 changes: 4 additions & 0 deletions .changes/1574.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "fixed",
"description": "`dockerfile` path is now relative to cargo workspace root"
}
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
Loading