Build step: No such file or directory

In case if you use incorrect path to Dockerfile or path to Build context you can see the following error message in the logs of the build step.

Text

Step 3/6 : COPY /output /app
lstat output: no such file or directory

Solution

Re-check, you use correct path to Dockerfile and Build context

  1. The path to Dockerfile.
  1. The path to Build context. Build context is where we can find your Dockerfile as well as running commands. Your Dockerfile must be relative to this directory.

codefresh_no_such_file_directory.png

In case with codefresh.yml, to specify the path to build context you need to use working_directory

build step

step_name:
  type: build
  title: Step Title
  description: Free text description
  working_directory: path/to/buildcontext
  dockerfile: path/to/Dockerfile
  image_name: owner/new-image-name
  tag: develop