How do I define my build with a Dockerfile?

Using a raw Dockerfile to define your build gives you full flexibility to do whatever you want to do. Anything Docker can do, Fire CI will execute.

You just need to add a YAML .fire.yml as below at the root of your repository.

version: 2

  dockerfile: Dockerfile

The build that Fire CI will execute is equivalent to you running the following command in your cloned working copy:

docker -f Dockerfile build .

The name of the Dockerfile to use should be specified in the .fire.yml file. This way you can have a dedicated file for CI runs called for example.

Fire CI will consider the build a success if all commands from the Dockerfile return 0 as an exit code. The build will be marked as failed otherwise.

IMPORTANT: Copying your source code into the container needs to be part of your Dockerfile. Fire CI does not do it automatically to let you leverage Docker multi layer caching if you want to. You can also check the 'Using YAML files' way of defining builds. Caching is already leverage if you define your builds using YAML files.

An example Dockerfile for a basic npm project could be:

FROM node
WORKDIR /root/app
COPY . .

RUN npm install
RUN npm test

If you go for a Dockerfile to define your build, it is highly recommended to add a .dockerignore file to your repository to optimize the build context sent to Docker. See the article about using YAML files for details on this part.

Here are the reference documentation and the best practices on writing Dockerfiles. You can contact us if you have questions. We'll be glad to help you.

What next?

The other ways of configuring your builds are through YAML files or Docker compose:

If you have questions or ideas do not hesitate to contact us at