Skip to content

Commit

Permalink
use correct target directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Emilgardis committed Jun 12, 2022
1 parent e85df33 commit e56d9be
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,8 @@ pub fn run(
"unconfined".to_string()
} else {
#[allow(unused_mut)] // target_os = "windows"
let mut path = env::current_dir()
.wrap_err("couldn't get current directory")?
.canonicalize()
.wrap_err_with(|| "when canonicalizing current_dir".to_string())?
.join("target")
let mut path = metadata
.target_directory
.join(target.triple())
.join("seccomp.json");
if !path.exists() {
Expand Down Expand Up @@ -374,6 +371,7 @@ pub fn run(
image = build
.build(
config,
metadata,
&engine,
&host_root,
config.dockerfile_build_args(target)?.unwrap_or_default(),
Expand All @@ -397,6 +395,7 @@ RUN eval "${{CROSS_CMD}}""#
custom
.build(
config,
metadata,
&engine,
&host_root,
Some(("CROSS_CMD", pre_build.join("\n"))),
Expand Down Expand Up @@ -431,6 +430,7 @@ impl<'a> Dockerfile<'a> {
pub fn build(
&self,
config: &Config,
metadata: &CargoMetadata,
engine: &Path,
host_root: &Path,
build_args: impl IntoIterator<Item = (impl AsRef<str>, impl AsRef<str>)>,
Expand Down Expand Up @@ -471,10 +471,10 @@ impl<'a> Dockerfile<'a> {
let path = match self {
Dockerfile::File { path, .. } => PathBuf::from(path),
Dockerfile::Custom { content } => {
let path = host_root
.join("target")
let path = metadata
.target_directory
.join(target_triple.to_string())
.join(format!("Dockerfile.{}", target_triple,));
.join(format!("Dockerfile.{}-custom", target_triple,));
{
let mut file = file::write_file(&path, true)?;
file.write_all(content.as_bytes())?;
Expand Down

0 comments on commit e56d9be

Please sign in to comment.