{"record":{"id":"6e20b226ef96caff","repo":"basecamp/kamal","slug":"missing-dockerfile","errorCode":null,"errorMessage":"Missing #{dockerfile}","messagePattern":"Missing #(.+?)","errorType":"exception","errorClass":"Kamal::Commands::Builder::BuilderError","httpStatus":null,"severity":"error","filePath":"lib/kamal/commands/builder/base.rb","lineNumber":106,"sourceCode":"    end\n\n    def build_labels\n      argumentize \"--label\", { service: config.service }\n    end\n\n    def build_args\n      argumentize \"--build-arg\", args, sensitive: true\n    end\n\n    def build_secrets\n      argumentize \"--secret\", secrets.keys.collect { |secret| [ \"id\", secret ] }\n    end\n\n    def build_dockerfile\n      if Pathname.new(File.expand_path(dockerfile)).exist?\n        argumentize \"--file\", dockerfile\n      else\n        raise BuilderError, \"Missing #{dockerfile}\"\n      end\n    end\n\n    def build_target\n      argumentize \"--target\", target if target.present?\n    end\n\n    def build_ssh\n      argumentize \"--ssh\", ssh if ssh.present?\n    end\n\n    def builder_provenance\n      argumentize \"--provenance\", provenance unless provenance.nil?\n    end\n\n    def builder_sbom\n      argumentize \"--sbom\", sbom unless sbom.nil?\n    end","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/basecamp/kamal/blob/eee0083b38661c3707c6b6052cc89e85038a096c/lib/kamal/commands/builder/base.rb#L88-L124","documentation":"When building images, Kamal::Commands::Builder::Base#build_dockerfile resolves the configured dockerfile path (from the builder's dockerfile option, default 'Dockerfile') relative to the current directory via File.expand_path, and adds `--file <dockerfile>` to the docker build command only if Pathname#exist? is true. If the file is not there, Kamal raises Kamal::Commands::Builder::BuilderError ('Missing <path>') before docker is invoked.","triggerScenarios":"`kamal build` (or any deploy that builds) when the builder config's dockerfile: points to a missing file (e.g. dockerfiles/app.dockerfile not committed), or when kamal is run from a directory other than the app root so the default Dockerfile isn't found (File.expand_path uses Dir.pwd, not the config dir).","commonSituations":"Monorepos where the Dockerfile lives in a subdirectory but kamal runs from the repo root (or vice versa); custom dockerfile: path with a typo or uncommitted file; CI checking out a sparse/partial tree that excludes the Dockerfile; running kamal from a gem directory or via a script that changed cwd.","solutions":["Verify the file exists at the path kamal resolves: run `ls <path>` from the directory where you invoke kamal (paths are expanded against the current working directory).","Fix the builder config to point at the real file (config/deploy.yml): builder: dockerfile: Dockerfile or a correct relative path from your kamal invocation directory.","In CI, ensure the checkout includes the Dockerfile and the job's working directory matches where the config expects it.","For monorepos, either cd into the app dir before running kamal or set the accurate relative dockerfile path."],"exampleFix":"# before (config/deploy.yml, run from repo root, app in ./app)\nbuilder:\n  dockerfile: Dockerfile   # repo-root Dockerfile missing -> BuilderError\n# after\nbuilder:\n  dockerfile: app/Dockerfile\n# or invoke kamal from the app directory containing the Dockerfile","handlingStrategy":"validation","validationCode":"require \"pathname\"\ndockerfile = \"Dockerfile\" # or read from config builder section\nFile.exist?(File.expand_path(dockerfile)) || abort(\"#{dockerfile} not found from #{Dir.pwd}; fix builder.dockerfile or cwd\")\nsystem(\"kamal build\")","typeGuard":"def dockerfile_resolves?(path)\n  Pathname.new(File.expand_path(path)).exist?\nend","tryCatchPattern":"begin\n  Kamal::CLI::Build.new.invoke(:deliver)\nrescue Kamal::Commands::Builder::BuilderError => e\n  raise unless e.message.start_with?(\"Missing\")\n  abort \"#{e.message} — run kamal from the directory containing the Dockerfile or fix builder.dockerfile\"\nend","preventionTips":["Commit the Dockerfile and run kamal from the app root so relative paths resolve identically everywhere.","In CI set an explicit working directory that matches the config's expected layout.","For monorepos, set builder: dockerfile: with the correct relative path per environment."],"tags":["kamal","build","dockerfile","config","file-not-found"],"backgroundTag":"dockerfile-not-found","analyzedSha":"eee0083b38661c3707c6b6052cc89e85038a096c","analyzedAt":"2026-08-21T15:17:22.045Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}