No Dockerfile found
Failed to fetch the Dockerfile from path
You have a build step in your pipeline that fails with the error message: “Repository does not contain a Dockerfile. Please check the pipeline configuration” or “Failed to fetch the Dockerfile from path”
Problem description
This error happens when you are trying to build a Docker image and the pipeline step cannot find a Dockerfile. It might be helpful to include a dummy step in your pipeline that prints all files in the workspace. This way you can verify what files are available to the pipeline.
pipeline step
print_pwd_files:
title: 'Listing files'
image: alpine:latest
commands:
- 'ls -l'
The solution
There are two ways to address this error:
First make sure that you have at least one clone step in your pipeline and that its name is main_clone
. This way the current folder will automatically be setup in the project folder of the git repository.
codefresh.yml
version: '1.0'
steps:
main_clone:
title: 'Cloning main repository...'
type: git-clone
repo: kostis-codefresh/example_nodejs_postgres
revision: master
git: github
myDockerImage:
title: 'Building My Docker Image'
type: build
dockerfile: Dockerfile
image_name: my-app-image
tag: from-master-branch
Secondly, if you checkout multiple git repositories or use another name in your git clone step, make sure that the build step looks at the correct directory:
codefresh.yml
version: '1.0'
steps:
checkoutApp:
title: 'Cloning a repository...'
type: git-clone
repo: kostis-codefresh/trivial-go-web
revision: master
git: github
myDockerImage:
title: 'Building Docker Image'
type: build
dockerfile: Dockerfile
working_directory: './trivial-go-web'
image_name: my-app-image
tag: from-master-branch
Notice the working_directory
property of the build step that searches for the Dockefile in the folder named trivial-go-web
instead of the root folder of the pipeline workspace.