Note: keep up to date to the latest improvements and contribute to this project on GitHub.
Note: Have a look at our VS Code toolchain.
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:
Copy the Dockerfile to e.g. /tmp/Dockerfile
:
Build the Docker image (this will take some time, but is only needed once):
Now you can build the sample, and if you change the source code, you can just execute this command again.
The firmware file will be in applications/asset_tracker/build/zephyr/merged.hex
.
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.