Build an Image with the Dockerfile in root directory
Get started quickly with building Docker images
Building a Docker image is one of the basic operations in Codefresh pipelines.
TIP
The source code of the repository is at https://github.com/codefreshdemo/cf-yml-example-build-dockerfile-inroot. Feel free to fork it if you want to follow along.
If you don’t have a Codefresh account already, you can easily create a free one from the sign-up page.
Building a Dockerfile from the root folder
By default, if you run a single command like the one below, Docker uses the Dockerfile of the current folder:
docker build . -t my-web-app
You can get the same result within a Codefresh pipeline:
codefresh.yml
This pipeline checks out the source code of the repository and then builds a dockerfile found at the root folder of the project.
You can also change the Docker build context by editing the working_directory
property. By default, it looks at the root folder of the project, but any subfolder path is also valid.
Related articles
CI/CD pipeline examples
Build step in pipelines
Build an Image by specifying the Dockerfile location
Build an Image from a different Git repository
Build and push an Image
Build an Image with build arguments