BlogNewsTop News

Build NCS application firmware images using Docker

By September 1, 2020No Comments

Written by Markus Tacker, Senior Engineer at Nordic Semiconductor, about a project he worked on in his free time.

This blog originally ran on Nordic’s DevZone blog. You can find more content like this here.

Getting all dependencies in place to build the sample applications in our SDK can be a challenge, and it requires to install certain version globally in the system, which might not be preferable for everyone. 

We can leverage Docker, a containerization tool, to contain the dependencies in a way that they do not affect to local system. The dependencies will be installed inside an image, which only uses disk space and we then can build the firmware inside this image

Here is an example Dockerfile for use with the current fw-nrfconnect-nrf tree.

Building the asset_tracker application with Docker

Clone the repo:

Compact Example

Docker image: coderbyheart/fw-nrfconnect-nrf-docker:latest

Note:Using a pre-build image is a convenient way to quickly build your firmware but using images from untrusted third-parties poses the risk of exposing your source code.

When using the pre-build docker image, you can skip the `docker build` step and directly run this command in your source folder to build the asset_tracker application:

Building out-of tree applications

If you maintain your application outside of the fw-nrfconnect-nrf tree (like we do with the Cat Tracker example in Bifravst), the solution works exactly the same, since west will fetch the dependencies in the same way.