diff --git a/src/lib.rs b/src/lib.rs index c880dbecb..6193d4a99 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,7 +29,7 @@ use crate::nixpacks::{ nix::pkg::Pkg, plan::{generator::NixpacksBuildPlanGenerator, BuildPlan, PlanGenerator}, }; -use anyhow::{bail, Result}; +use anyhow::Result; use nixpacks::plan::generator::GeneratePlanOptions; use providers::{ clojure::ClojureProvider, crystal::CrystalProvider, csharp::CSharpProvider, dart::DartProvider, @@ -93,12 +93,6 @@ pub fn create_docker_image( let mut generator = NixpacksBuildPlanGenerator::new(get_providers(), plan_options.clone()); let plan = generator.generate_plan(&app, &environment)?; - if let Some(ref phase) = plan.start_phase { - if phase.cmd.is_none() && !build_options.no_error_without_start { - bail!("No start command could be found") - } - } - let logger = Logger::new(); let builder = DockerImageBuilder::new(logger, build_options.clone()); builder.create_image(app.source.to_str().unwrap(), &plan, &environment)?; diff --git a/src/nixpacks/builder/docker/docker_image_builder.rs b/src/nixpacks/builder/docker/docker_image_builder.rs index 54d391500..37007cf83 100644 --- a/src/nixpacks/builder/docker/docker_image_builder.rs +++ b/src/nixpacks/builder/docker/docker_image_builder.rs @@ -48,6 +48,11 @@ impl ImageBuilder for DockerImageBuilder { println!("{}", plan.get_build_string()?); + let start = plan.start_phase.clone().unwrap_or_default(); + if start.cmd.is_none() && !self.options.no_error_without_start { + bail!("No start command could be found") + } + self.write_app(app_src, &output).context("Writing app")?; self.write_dockerfile(dockerfile, &output) .context("Writing Dockerfile")?;