v1

To build and run code from one branch on a repository you can use:

  • a combined service
  • a build service linked to a deployment service
  • a cron or manual job

Create a new service or job, select the Git provider that contains the repository you want to build from, then select the branch.

Once created your service will build an image for every new commit to the branches or pull requests it is monitoring, as long as CI is enabled.

You can manually trigger a build by navigating to the branch or pull request to build from and selecting a commit to build.

You can find the list of branches and pull requests in the build service menu, or by clicking the build button in the build service header.

Northflank will begin building your commit, which may take several minutes. You can monitor the progress from the builds page and click through to view the logs for the build.

If you have a single repository with multiple services, or your repository is structured so that your build context or Dockerfile are not in the root, you can specify their locations when creating or editing your services.

You can specify the set of files to be used in the Docker build process by referring to a specific subdirectory relative to the root of your repository. To build all files from the root, use / as the build context or refer to a subdirectory such as /directory or /directory/subdirectory.

Learn more about Docker contexts .

You can specify the location of the Dockerfile relative to the root of the repository. For example root: /Dockerfile, or in a subdirectory: /directory/subdirectory/Dockerfile.

Learn more about the Dockerfile .

Available on combined and build services.

Build arguments (ARG) can be set to be passed to the Docker container at build-time. These can be set for individual builds on the build arguments page or set as project secrets to be applied to all or specific builds in a project.

Build arguments will be passed to the Dockerfile on build via the --build-arg flag. They do not persist in the built image and are set as key-value pairs. Variables must be declared in the Dockerfile with ARG before being accessed. For example, a variable set as "packages" : "npm-cache" can be accessed in the Dockerfile by declaring the ARG:

ARG packages
# or initialise with a default value:
# ARG packages=default_value

RUN echo "Using: ${packages}"

Build arguments are entered as key-value pairs, or by using JSON by toggling JSON view on and using the following format:

{
    "key1": "value1",
    "key2": "value2"
}

An .env file can also be uploaded and edited using the following format:

KEY_1=value1
KEY_2=value2

The default Northflank build engine provides a balance of speed and reliability. You can choose to use the alternative build engine if you experience any issues with your builds from the advanced options section in build options.

© 2021 Northflank Ltd. All rights reserved.