Git Product home page Git Product logo

nrf-docker's People

Contributors

3nigma avatar coderbyheart avatar erikkallen avatar fgervais avatar gregersrygg avatar himel55 avatar jfroy avatar marinjurjevic avatar matteoscordino avatar osaboh avatar robertgalatnordic avatar uvok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nrf-docker's Issues

ZEPHYR_BASE change breaks build?

It seems that a recent change to the ZEPHYR_BASE env var bothers the build on my side.

More info here:

266d97a#r94443552

If I override it back (ZEPHYR_BASE=/workdir/project/zephyr) when running the image, it builds fine again.

Consider pushing image also to ghcr.io

Hi!

We have a few Zephyr/nRF related repositories, one of them is a private repo. for the end customer firmware. When we tag a release there we'd like to have everything needed to rebuild/patch/fix from that tag a few years down the line, relying on our GitHub action to rebuild with the same build deps used when we created the tag.

This nrf-docker project looks exactly like what I wanted to set up myself. Have you considered pushing the resulting Docker images also to the GitHub Container Repository, ghcr.io? This would greatly speed up download and build times for GitHub actions.

If you're interested, here's an example of what I did to automate our pandoc docker image to push to ghcr.io:

name: Pandoc Docker Container

on:
  push:
    branches:
      - 'main'
    tags:
      - 'v*'
    paths:
      - 'Dockerfile'
  workflow_dispatch:

env:
  IMAGE_NAME: pandoc

jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      packages: write
      contents: read
    steps:
      - uses: actions/checkout@v2
      - name: Build image
        run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
      - name: Log in to registry
        run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
      - name: Push image
        run: |
          IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
          # Change all uppercase to lowercase
          IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
          # Strip git ref prefix from version
          VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
          # Use Docker `latest` tag convention
          [ "$VERSION" == "main" ] && VERSION=latest
          echo IMAGE_ID=$IMAGE_ID
          echo VERSION=$VERSION
          docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
          docker push $IMAGE_ID:$VERSION

Cheers
/Joachim

nrfutil incompatible with nRF Connect SDK v2.1.x

nrfutil 6.1.6 requires protobuf<4.0.0,>=3.17.3, but you have protobuf 4.21.6 which is incompatible.

However, Zephyr's zephyr/scripts/requirements.txt pulls in protobuf<5.0dev,>=4.21.3

2022-09-16T06:51:06.1154365Z Collecting protobuf<5.0dev,>=4.21.3
2022-09-16T06:51:06.1272020Z   Downloading protobuf-4.21.6-cp37-abi3-manylinux2014_x86_64.whl (408 kB)
...
2022-09-16T06:51:13.8446430Z   Attempting uninstall: protobuf
2022-09-16T06:51:13.8455355Z     Found existing installation: protobuf 3.20.2
2022-09-16T06:51:13.8604992Z     Uninstalling protobuf-3.20.2:
2022-09-16T06:51:13.9597279Z       Successfully uninstalled protobuf-3.20.2

download version of nrfutil

One thing that I have an issue with in this docker image is not being able to install a specific version of nrfutil tool. Since all of the stuff we deal with in NCS and Zephyr is highly versioned (personally I think that is great) it would be good to enable for this tool to have that as well.

As I understand tool is not open nor on GH and on the Nordic website there is no option to download a specific version, just the latest.

nrf-docker doesn't work on Windows

It fails because Dockerfile can be checked out with windows line ending.

This is a fix: add the following line to .gitattributes :

Dockerfile text eol=lf

Building for Mac with the M1 architecture is broken

When build for the Mac with the M1 architecture arm64 commit 9bf72b8 (#57) breaks the image build.

Command used:
docker build -t nrfconnect-sdk --build-arg arch=arm64 --build-arg sdk_nrf_revision=v2.3-branch .

Failure:

#6 17.13 Package gcc-multilib is not available, but is referred to by another package.
#6 17.13 This may mean that the package is missing, has been obsoleted, or
#6 17.13 is only available from another source
#6 17.13 
#6 17.14 E: Package 'gcc-multilib' has no installation candidate

Full failing build output:

$ docker build -t nrfconnect-sdk --build-arg arch=arm64 --build-arg sdk_nrf_revision=v2.3-branch .
[+] Building 32.4s (6/9)                                                        
 => [internal] load build definition from Dockerfile                       0.0s
 => => transferring dockerfile: 6.54kB                                     0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.04            8.5s
 => [base 1/3] FROM docker.io/library/ubuntu:22.04@sha256:67211c14fa74f07  6.6s
 => => resolve docker.io/library/ubuntu:22.04@sha256:67211c14fa74f070d27c  0.0s
 => => sha256:67211c14fa74f070d27cc59d69a7fa9aeff8e28ea11 1.13kB / 1.13kB  0.0s
 => => sha256:537da24818633b45fcb65e5285a68c3ec1f3db25f5ae547 424B / 424B  0.0s
 => => sha256:bab8ce5c00ca3ef91e0d3eb4c6e6d6ec7cffa9574c4 2.32kB / 2.32kB  0.0s
 => => sha256:cd741b12a7eaa64357041c2d3f4590c898313a7f8 27.35MB / 27.35MB  6.0s
 => => extracting sha256:cd741b12a7eaa64357041c2d3f4590c898313a7f8f65cd15  0.4s
 => [base 2/3] WORKDIR /workdir                                            0.1s
 => ERROR [base 3/3] RUN mkdir /workdir/.cache &&     apt-get -y update   17.2s
------                                                                          
 > [base 3/3] RUN mkdir /workdir/.cache &&     apt-get -y update &&     apt-get -y upgrade &&     apt-get -y install         wget         python3-pip         python3-venv         ninja-build         gperf         git         unzip         libncurses5 libncurses5-dev         libyaml-dev libfdt1         libusb-1.0-0-dev udev         device-tree-compiler         xz-utils         file         gcc-multilib         ruby &&     apt-get -y clean && apt-get -y autoremove &&     python3 -m pip install -U pip &&     python3 -m pip install -U pipx &&     python3 -m pip install -U setuptools &&     python3 -m pip install 'cmake>=3.20.0' wheel &&     python3 -m pip install -U "west==0.14.0" &&     python3 -m pip install pc_ble_driver_py &&     python3 -m pip install --ignore-installed -U PyYAML &&     case arm64 in     "amd64")         PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin         pipx install "nrfutil==6.1.7"         ;;     esac &&     python3 -m pip install -U six &&     apt-get -y install clang-format &&     wget -qO- https://raw.githubusercontent.com/nrfconnect/sdk-nrf/main/.clang-format > /workdir/.clang-format &&     NCLT_BASE=https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/desktop-software/nrf-command-line-tools/sw/versions-10-x-x &&     echo "Host architecture: arm64" &&     case arm64 in         "amd64")             NCLT_URL="${NCLT_BASE}/10-18-1/nrf-command-line-tools-10.18.1_linux-amd64.tar.gz"             ;;         "arm64")             NCLT_URL="${NCLT_BASE}/10-18-1/nrf-command-line-tools-10.18.1_linux-arm64.tar.gz"             ;;     esac &&     echo "NCLT_URL=${NCLT_URL}" &&     if [ ! -z "$NCLT_URL" ]; then         mkdir tmp && cd tmp &&         wget -qO - "${NCLT_URL}" | tar --no-same-owner -xz &&         DEBIAN_FRONTEND=noninteractive apt-get -y install ./*.deb &&         cp -r ./nrf-command-line-tools /opt &&         ln -s /opt/nrf-command-line-tools/bin/nrfjprog /usr/local/bin/nrfjprog &&         ln -s /opt/nrf-command-line-tools/bin/mergehex /usr/local/bin/mergehex &&         cd .. && rm -rf tmp ;     else         echo "Skipping nRF Command Line Tools (not available for arm64)" ;     fi &&     echo "Host architecture: arm64" &&     echo "Target architecture: arm-zephyr-eabi" &&     echo "Zephyr Toolchain version: 0.15.2" &&     case arm64 in         "amd64")             ZEPHYR_MINIMAL_BUNDLE_URL="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.2/zephyr-sdk-0.15.2_linux-x86_64_minimal.tar.gz"             ;;         "arm64")             ZEPHYR_MINIMAL_BUNDLE_URL="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.2/zephyr-sdk-0.15.2_macos-aarch64_minimal.tar.gz"             ;;         *)             echo "Unsupported host architecture: "arm64"" >&2 &&             exit 1 ;;     esac &&     echo "Install Zephyr SDK from ZEPHYR_MINIMAL_BUNDLE_URL=${ZEPHYR_MINIMAL_BUNDLE_URL}" &&     wget -qO - "${ZEPHYR_MINIMAL_BUNDLE_URL}" | tar xz &&     mv /workdir/zephyr-sdk-0.15.2 /workdir/zephyr-sdk && cd /workdir/zephyr-sdk &&     case arm64 in         "arm64")             ./setup.sh -t aarch64-zephyr-elf -c             ;;         *)             yes | ./setup.sh -t arm-zephyr-eabi             ;;     esac &&     if [ $(expr match "0.15.2" "0\.14\.*") -ne 0 ]; then         apt-get -y install software-properties-common &&         add-apt-repository -y ppa:deadsnakes/ppa &&         apt-get -y update &&         apt-get -y install python3.8 python3.8-dev &&         python3.8 --version;     fi:
#6 1.167 Get:1 http://ports.ubuntu.com/ubuntu-ports jammy InRelease [270 kB]
#6 2.926 Get:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease [119 kB]
#6 3.578 Get:3 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease [107 kB]
#6 3.993 Get:4 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease [110 kB]
#6 4.441 Get:5 http://ports.ubuntu.com/ubuntu-ports jammy/main arm64 Packages [1758 kB]
#6 5.629 Get:6 http://ports.ubuntu.com/ubuntu-ports jammy/restricted arm64 Packages [24.2 kB]
#6 5.866 Get:7 http://ports.ubuntu.com/ubuntu-ports jammy/universe arm64 Packages [17.2 MB]
#6 8.819 Get:8 http://ports.ubuntu.com/ubuntu-ports jammy/multiverse arm64 Packages [224 kB]
#6 9.141 Get:9 http://ports.ubuntu.com/ubuntu-ports jammy-updates/multiverse arm64 Packages [14.3 kB]
#6 9.432 Get:10 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 Packages [1109 kB]
#6 9.902 Get:11 http://ports.ubuntu.com/ubuntu-ports jammy-updates/restricted arm64 Packages [423 kB]
#6 10.67 Get:12 http://ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 Packages [1005 kB]
#6 13.02 Get:13 http://ports.ubuntu.com/ubuntu-ports jammy-backports/main arm64 Packages [49.0 kB]
#6 13.30 Get:14 http://ports.ubuntu.com/ubuntu-ports jammy-backports/universe arm64 Packages [22.4 kB]
#6 13.64 Get:15 http://ports.ubuntu.com/ubuntu-ports jammy-security/multiverse arm64 Packages [10.2 kB]
#6 13.91 Get:16 http://ports.ubuntu.com/ubuntu-ports jammy-security/restricted arm64 Packages [410 kB]
#6 14.40 Get:17 http://ports.ubuntu.com/ubuntu-ports jammy-security/main arm64 Packages [785 kB]
#6 14.92 Get:18 http://ports.ubuntu.com/ubuntu-ports jammy-security/universe arm64 Packages [765 kB]
#6 15.10 Fetched 24.4 MB in 15s (1636 kB/s)
#6 15.10 Reading package lists...
#6 15.72 Reading package lists...
#6 16.24 Building dependency tree...
#6 16.35 Reading state information...
#6 16.38 Calculating upgrade...
#6 16.51 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
#6 16.54 Reading package lists...
#6 17.03 Building dependency tree...
#6 17.13 Reading state information...
#6 17.13 Package gcc-multilib is not available, but is referred to by another package.
#6 17.13 This may mean that the package is missing, has been obsoleted, or
#6 17.13 is only available from another source
#6 17.13 
#6 17.14 E: Package 'gcc-multilib' has no installation candidate
------
executor failed running [/bin/sh -c mkdir /workdir/.cache &&     apt-get -y update &&     apt-get -y upgrade &&     apt-get -y install         wget         python3-pip         python3-venv         ninja-build         gperf         git         unzip         libncurses5 libncurses5-dev         libyaml-dev libfdt1         libusb-1.0-0-dev udev         device-tree-compiler         xz-utils         file         gcc-multilib         ruby &&     apt-get -y clean && apt-get -y autoremove &&     python3 -m pip install -U pip &&     python3 -m pip install -U pipx &&     python3 -m pip install -U setuptools &&     python3 -m pip install 'cmake>=3.20.0' wheel &&     python3 -m pip install -U "west==${WEST_VERSION}" &&     python3 -m pip install pc_ble_driver_py &&     python3 -m pip install --ignore-installed -U PyYAML &&     case $arch in     "amd64")         PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin         pipx install "nrfutil==${NRF_UTIL_VERSION}"         ;;     esac &&     python3 -m pip install -U six &&     apt-get -y install clang-format &&     wget -qO- https://raw.githubusercontent.com/nrfconnect/sdk-nrf/main/.clang-format > /workdir/.clang-format &&     NCLT_BASE=https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/desktop-software/nrf-command-line-tools/sw/versions-10-x-x &&     echo "Host architecture: $arch" &&     case $arch in         "amd64")             NCLT_URL="${NCLT_BASE}/${NORDIC_COMMAND_LINE_TOOLS_VERSION}_linux-amd64.tar.gz"             ;;         "arm64")             NCLT_URL="${NCLT_BASE}/${NORDIC_COMMAND_LINE_TOOLS_VERSION}_linux-arm64.tar.gz"             ;;     esac &&     echo "NCLT_URL=${NCLT_URL}" &&     if [ ! -z "$NCLT_URL" ]; then         mkdir tmp && cd tmp &&         wget -qO - "${NCLT_URL}" | tar --no-same-owner -xz &&         DEBIAN_FRONTEND=noninteractive apt-get -y install ./*.deb &&         cp -r ./nrf-command-line-tools /opt &&         ln -s /opt/nrf-command-line-tools/bin/nrfjprog /usr/local/bin/nrfjprog &&         ln -s /opt/nrf-command-line-tools/bin/mergehex /usr/local/bin/mergehex &&         cd .. && rm -rf tmp ;     else         echo "Skipping nRF Command Line Tools (not available for $arch)" ;     fi &&     echo "Host architecture: ${arch}" &&     echo "Target architecture: ${crossarch}" &&     echo "Zephyr Toolchain version: ${ZEPHYR_TOOLCHAIN_VERSION}" &&     case $arch in         "amd64")             ZEPHYR_MINIMAL_BUNDLE_URL="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_TOOLCHAIN_VERSION}/zephyr-sdk-${ZEPHYR_TOOLCHAIN_VERSION}_linux-x86_64_minimal.tar.gz"             ;;         "arm64")             ZEPHYR_MINIMAL_BUNDLE_URL="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_TOOLCHAIN_VERSION}/zephyr-sdk-${ZEPHYR_TOOLCHAIN_VERSION}_macos-aarch64_minimal.tar.gz"             ;;         *)             echo "Unsupported host architecture: \"${arch}\"" >&2 &&             exit 1 ;;     esac &&     echo "Install Zephyr SDK from ZEPHYR_MINIMAL_BUNDLE_URL=${ZEPHYR_MINIMAL_BUNDLE_URL}" &&     wget -qO - "${ZEPHYR_MINIMAL_BUNDLE_URL}" | tar xz &&     mv /workdir/zephyr-sdk-${ZEPHYR_TOOLCHAIN_VERSION} /workdir/zephyr-sdk && cd /workdir/zephyr-sdk &&     case $arch in         "arm64")             ./setup.sh -t aarch64-zephyr-elf -c             ;;         *)             yes | ./setup.sh -t ${crossarch}             ;;     esac &&     if [ $(expr match "$ZEPHYR_TOOLCHAIN_VERSION" "0\.14\.*") -ne 0 ]; then         apt-get -y install software-properties-common &&         add-apt-repository -y ppa:deadsnakes/ppa &&         apt-get -y update &&         apt-get -y install python3.8 python3.8-dev &&         python3.8 --version;     fi]: exit code: 100

`nrfutil` fails to run in at least `v1.8-branch`?

It looks like there might be a problem with nrfutil.

I only tested with v1.8-branch for now as this is what I'm using in my current project.

fgervais@fgervais-System-Product-Name:~/personal/project-nrf-thread-switch_west/application$ docker pull nordicplayground/nrfconnect-sdk:v1.8-branch
v1.8-branch: Pulling from nordicplayground/nrfconnect-sdk
Digest: sha256:cb484e62d605c2edb8be030496d12df5f4b29da838c86de3f7c1357769ca25d5
Status: Image is up to date for nordicplayground/nrfconnect-sdk:v1.8-branch
docker.io/nordicplayground/nrfconnect-sdk:v1.8-branch

fgervais@fgervais-System-Product-Name:~/personal/project-nrf-thread-switch_west/application$ docker run --rm nordicplayground/nrfconnect-sdk:v1.8-branch nrfutil
Traceback (most recent call last):
  File "/usr/local/bin/nrfutil", line 5, in <module>
    from nordicsemi.__main__ import cli
  File "/usr/local/lib/python3.8/dist-packages/nordicsemi/__main__.py", line 49, in <module>
    from nordicsemi.dfu.bl_dfu_sett import BLDFUSettings
  File "/usr/local/lib/python3.8/dist-packages/nordicsemi/dfu/bl_dfu_sett.py", line 51, in <module>
    from nordicsemi.dfu.package import Package
  File "/usr/local/lib/python3.8/dist-packages/nordicsemi/dfu/package.py", line 53, in <module>
    from nordicsemi.dfu.init_packet_pb import InitPacketPB, DFUType, CommandTypes, ValidationTypes, SigningTypes, HashTypes
  File "/usr/local/lib/python3.8/dist-packages/nordicsemi/dfu/init_packet_pb.py", line 38, in <module>
    from . import dfu_cc_pb2 as pb
  File "/usr/local/lib/python3.8/dist-packages/nordicsemi/dfu/dfu_cc_pb2.py", line 32, in <module>
    _descriptor.EnumValueDescriptor(
  File "/usr/local/lib/python3.8/dist-packages/google/protobuf/descriptor.py", line 755, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

As a comparaison, this is working with the nrfassettracker/nrfconnect-sdk:v1.8-branch:

fgervais@fgervais-System-Product-Name:~/personal/project-nrf-thread-switch_west/application$ docker images --no-trunc --quiet nrfassettracker/nrfconnect-sdk:v1.8-branch
sha256:8bfa2ca95b7f645af6a49a9cff12a3203adbe12460e0e24c9fee0171fafd57d2

fgervais@fgervais-System-Product-Name:~/personal/project-nrf-thread-switch_west/application$ docker run --rm nrfassettracker/nrfconnect-sdk:v1.8-branch nrfutil
Usage: nrfutil [OPTIONS] COMMAND [ARGS]...

Options:
  -v, --verbose            Increase verbosity of output. Can be specified more
                           than once (up to -v -v -v -v).
  -o, --output <filename>  Log output to file
  --help                   Show this message and exit.

Commands:
  dfu       Perform a Device Firmware Update over serial, BLE, Thread, Zigbee
            or ANT transport given a DFU package (zip file).
  keys      Generate and display private and public keys.
  pkg       Display or generate a DFU package (zip file).
  settings  Generate and display Bootloader DFU settings.
  version   Display nrfutil version.
  zigbee    Zigbee-related commands and utilities.

ZEPHYR_TOOLCHAIN_VERSION versions are different than recommended versions on

The ZEPHYR_TOOLCHAIN_VERSION tests seem different than the recommended install version on the nrf documentation.

For 2.4.0 it should be 0.16.0
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.0/nrf/getting_started/installing.html

  • ncs_branch: v2.4-branch
    ZEPHYR_TOOLCHAIN_VERSION: 0.15.2
    ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT: gz

For 2.2.0 it should be 0.15.1
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/nrf/gs_installing.html

  • ncs_branch: v2.2-branch
    ZEPHYR_TOOLCHAIN_VERSION: 0.15.2
    ZEPHYR_TOOLCHAIN_ARCHIVE_FORMAT: gz

Dockerfile not working with mcuboot west update

I get the following errors trying to build the Docker image from this repo with docker build . -t sometag

This did not happen 1 or 2 months ago.

...
--- zcbor: fetching, need revision 0.6.0
195.0 From https://github.com/zephyrproject-rtos/zcbor
195.0  * tag               0.6.0      -> FETCH_HEAD
195.1 HEAD is now at 0556eda Update version from 0.5.99 to 0.6.0
195.1 HEAD is now at 0556eda Update version from 0.5.99 to 0.6.0
195.1 === updating zscilib (modules/lib/zscilib):
195.1 --- zscilib: initializing
195.1 Initialized empty Git repository in /workdir/modules/lib/zscilib/.git/
195.1 --- zscilib: fetching, need revision 0035be5e6a45e4ab89755b176d305d7a877fc79c
195.9 From https://github.com/zephyrproject-rtos/zscilib
195.9  * branch            0035be5e6a45e4ab89755b176d305d7a877fc79c -> FETCH_HEAD
195.9 HEAD is now at 0035be5 Merge pull request #45 from uLipe/feature/qrd_no_recursion
195.9 HEAD is now at 0035be5 Merge pull request #45 from uLipe/feature/qrd_no_recursion
195.9 ERROR: update failed for project mcuboot
196.0 Error: Launched process exited with non-zero status: 1
------
Dockerfile:74
--------------------
  73 |     SHELL ["nrfutil","toolchain-manager","launch","/bin/bash","--","-c"]
  74 | >>> RUN <<EOT
  75 | >>>     west init -m https://github.com/nrfconnect/sdk-nrf --mr ${sdk_nrf_branch} .
  76 | >>>     if [[ $sdk_nrf_commit =~ "^[a-fA-F0-9]{32}$" ]]; then
  77 | >>>         git checkout ${sdk_nrf_commit};
  78 | >>>     fi
  79 | >>>     west update --narrow -o=--depth=1
  80 | >>> EOT
  81 |     
--------------------
ERROR: failed to solve: process "nrfutil toolchain-manager launch /bin/bash -- -c     west init -m https://github.com/nrfconnect/sdk-nrf --mr ${sdk_nrf_branch} .\n    if [[ $sdk_nrf_commit =~ \"^[a-fA-F0-9]{32}$\" ]]; then\n        git checkout ${sdk_nrf_commit};\n    fi\n    west update --narrow -o=--depth=1\n" did not complete successfully: exit code: 1

so basically the line west update --narrow -o=--depth=1 fails at 195.9 ERROR: update failed for project mcuboot,

BUT I tried to analyse this manually inside a docker terminal and ran this command manually and it also failed the first time, but I just wanted to see what happens when I simply call the exact same command (west update) again, and it worked!

This happened on two different machines and with the versions: ARG toolchain_version=v2.4.1 and ARG toolchain_version=v2.4.0.

image

here you can see the failing mcuboot west update and my successful re-attempt directly afterwards.

Interactively flashing hex-file lacks dependencies and correct target specification

When trying to build and flash the hello_world sample as discussed in the docs on the BBC micro:bit, the process fails with the below errors.

Note how flashing is not possible due to

  • two dependencies missing
    • libffi7 as well as
    • libusb and
  • the target nrf52833 not being recognized by pyocd.
> podman run --rm -it --device=/dev/ttyACM0 --privileged -v $(pwd)/hello_world:/workdir/project docker.io/nordicplayground/nrfconnect-sdk:v2.4-branch /bin/bash
root@561dd82b6b30:/workdir# cd project/
root@561dd82b6b30:/workdir/project# west build -b bbc_microbit_v2 ../zephyr/samples/hello_world/ --pristine
-- west build: making build dir /workdir/project/build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: /workdir/zephyr/samples/hello_world
-- CMake version: 3.20.5
-- Using NCS Toolchain 2.4.0 for building. (/root/ncs/toolchains/1f9b40e71a/cmake)
-- Found Python3: /root/ncs/toolchains/1f9b40e71a/usr/local/bin/python3 (found suitable exact version "3.8.2") found components: Interpreter 
-- Cache files will be written to: /workdir/zephyr/.cache
-- Zephyr version: 3.3.99 (/workdir/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
-- Board: bbc_microbit_v2
-- Found host-tools: zephyr 0.16.0 (/root/ncs/toolchains/1f9b40e71a/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.0 (/root/ncs/toolchains/1f9b40e71a/opt/zephyr-sdk)
-- Found Dtc: /root/ncs/toolchains/1f9b40e71a/usr/local/bin/dtc (found suitable version "1.4.7", minimum required is "1.4.6") 
-- Found BOARD.dts: /workdir/zephyr/boards/arm/bbc_microbit_v2/bbc_microbit_v2.dts
-- Generated zephyr.dts: /workdir/project/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /workdir/project/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /workdir/project/build/zephyr/dts.cmake
Parsing /workdir/zephyr/Kconfig
Loaded configuration '/workdir/zephyr/boards/arm/bbc_microbit_v2/bbc_microbit_v2_defconfig'
Merged configuration '/workdir/zephyr/samples/hello_world/prj.conf'
Configuration saved to '/workdir/project/build/zephyr/.config'
Kconfig header saved to '/workdir/project/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: /root/ncs/toolchains/1f9b40e71a/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd (found version "2.38") 
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /root/ncs/toolchains/1f9b40e71a/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc
CMake Warning at ../../CMakeLists.txt:839 (message):
  No SOURCES given to Zephyr library: lib__libc__common

  Excluding target from build.


-- Configuring done
-- Generating done
-- Build files have been written to: /workdir/project/build
-- west build: building application
[1/175] Preparing syscall dependency handling

[2/175] Generating include/generated/version.h
-- Zephyr version: 3.3.99 (/workdir/zephyr), build: 28a3fca7da5c
[165/175] Linking C executable zephyr/zephyr_pre0.elf

[169/175] Linking C executable zephyr/zephyr_pre1.elf

[175/175] Linking C executable zephyr/zephyr.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:       27264 B       512 KB      5.20%
             RAM:        5624 B       128 KB      4.29%
        IDT_LIST:          0 GB         2 KB      0.00%
root@561dd82b6b30:/workdir/project# apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
Get:5 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1082 kB]
Get:6 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1347 kB]
Get:7 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1005 kB]
Get:8 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1270 kB]
Fetched 5041 kB in 2s (2927 kB/s)                        
Reading package lists... Done
root@561dd82b6b30:/workdir/project# apt-get install libffi7
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  libffi7
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 19.9 kB of archives.
After this operation, 67.6 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu jammy/universe amd64 libffi7 amd64 3.3-5ubuntu1 [19.9 kB]
Fetched 19.9 kB in 0s (56.1 kB/s) 
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libffi7:amd64.
(Reading database ... 5758 files and directories currently installed.)
Preparing to unpack .../libffi7_3.3-5ubuntu1_amd64.deb ...
Unpacking libffi7:amd64 (3.3-5ubuntu1) ...
Setting up libffi7:amd64 (3.3-5ubuntu1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.4) ...
root@561dd82b6b30:/workdir/project# west flash
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner pyocd
-- runners.pyocd: Flashing file: /workdir/project/build/zephyr/zephyr.hex
0000923:WARNING:pyusb_backend:CMSIS-DAPv1 probes may not be detected because no libusb library was found.
0000965:WARNING:common:STLink and CMSIS-DAPv2 probes are not supported because no libusb library was found.
Waiting for a debug probe to be connected...
^C
root@561dd82b6b30:/workdir/project# apt-get install libusb-1.0.0-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libusb-1.0-0-dev' for regex 'libusb-1.0.0-dev'
The following additional packages will be installed:
  libusb-1.0-0 libusb-1.0-doc
The following NEW packages will be installed:
  libusb-1.0-0 libusb-1.0-0-dev libusb-1.0-doc
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 312 kB of archives.
After this operation, 2088 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libusb-1.0-0 amd64 2:1.0.25-1ubuntu2 [52.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libusb-1.0-0-dev amd64 2:1.0.25-1ubuntu2 [76.3 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 libusb-1.0-doc all 2:1.0.25-1ubuntu2 [183 kB]
Fetched 312 kB in 1s (384 kB/s)       
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libusb-1.0-0:amd64.
(Reading database ... 5763 files and directories currently installed.)
Preparing to unpack .../libusb-1.0-0_2%3a1.0.25-1ubuntu2_amd64.deb ...
Unpacking libusb-1.0-0:amd64 (2:1.0.25-1ubuntu2) ...
Selecting previously unselected package libusb-1.0-0-dev:amd64.
Preparing to unpack .../libusb-1.0-0-dev_2%3a1.0.25-1ubuntu2_amd64.deb ...
Unpacking libusb-1.0-0-dev:amd64 (2:1.0.25-1ubuntu2) ...
Selecting previously unselected package libusb-1.0-doc.
Preparing to unpack .../libusb-1.0-doc_2%3a1.0.25-1ubuntu2_all.deb ...
Unpacking libusb-1.0-doc (2:1.0.25-1ubuntu2) ...
Setting up libusb-1.0-doc (2:1.0.25-1ubuntu2) ...
Setting up libusb-1.0-0:amd64 (2:1.0.25-1ubuntu2) ...
Setting up libusb-1.0-0-dev:amd64 (2:1.0.25-1ubuntu2) ...
Processing triggers for libc-bin (2.35-0ubuntu3.4) ...
root@561dd82b6b30:/workdir/project# west flash
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner pyocd
-- runners.pyocd: Flashing file: /workdir/project/build/zephyr/zephyr.hex
0001156:CRITICAL:__main__:Target type 'nrf52833' not recognized. Use 'pyocd list --targets' to see currently available target types. See <https://github.com/mbedmicro/pyOCD/blob/master/docs/target_support.md> for how to install additional target support.
Traceback (most recent call last):
  File "/root/ncs/toolchains/1f9b40e71a/usr/local/lib/python3.8/site-packages/pyocd/board/board.py", line 61, in __init__
    self.target = TARGET[self._target_type](session)
KeyError: 'nrf52833'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/root/ncs/toolchains/1f9b40e71a/usr/local/lib/python3.8/site-packages/pyocd/__main__.py", line 401, in run
    self._COMMANDS[self._args.cmd](self)
  File "/root/ncs/toolchains/1f9b40e71a/usr/local/lib/python3.8/site-packages/pyocd/__main__.py", line 556, in do_flash
    session = ConnectHelper.session_with_chosen_probe(
  File "/root/ncs/toolchains/1f9b40e71a/usr/local/lib/python3.8/site-packages/pyocd/core/helpers.py", line 242, in session_with_chosen_probe
    return Session(probe, auto_open=auto_open, options=options, **kwargs)
  File "/root/ncs/toolchains/1f9b40e71a/usr/local/lib/python3.8/site-packages/pyocd/core/session.py", line 188, in __init__
    self._board = probe.create_associated_board() \
  File "/root/ncs/toolchains/1f9b40e71a/usr/local/lib/python3.8/site-packages/pyocd/probe/cmsis_dap_probe.py", line 142, in create_associated_board
    return MbedBoard(self.session, board_id=self.unique_id[0:4])
  File "/root/ncs/toolchains/1f9b40e71a/usr/local/lib/python3.8/site-packages/pyocd/board/mbed_board.py", line 67, in __init__
    super(MbedBoard, self).__init__(session, target)
  File "/root/ncs/toolchains/1f9b40e71a/usr/local/lib/python3.8/site-packages/pyocd/board/board.py", line 63, in __init__
    six.raise_from(exceptions.TargetSupportError(
  File "<string>", line 3, in raise_from
pyocd.core.exceptions.TargetSupportError: Target type 'nrf52833' not recognized. Use 'pyocd list --targets' to see currently available target types. See <https://github.com/mbedmicro/pyOCD/blob/master/docs/target_support.md> for how to install additional target support.
FATAL ERROR: command exited with status 1: pyocd flash -e sector -t nrf52833 /workdir/project/build/zephyr/zephyr.hex

As shown above, it is possible to overcome the issues by installing the packages libffi7 as well as libusb-1.0.0-dev inside the container. Furthermore, one has to do the call to pyocd by hand:

pyocd flash -e sector -t nrf52 /workdir/project/build/zephyr/zephyr.hex

Regarding libusb: there are multiple libusb packages shipped under Ubuntu. I did not try any package other than the one mentioned above. It might be sufficient to install libusb-1.0.0.

I will happily prepare a PR for fixing the dependencies, if I get some guidance on which libusb package to choose. Having a look into west flash to fix the call to pyocd is beyond my resources, I'm afraid.

compile_commands.json not generated

Hi,
If I compile my project inside the container I don't have a compile_commands.json. However, if I compite it on my machine with nRF connect for vscode it is generated, with the ncs 1.8.0
Any idea why?

Thank you

Add `set -euxo pipefail` to all HereDocs in the Dockerfile

The HereDocs are basically shell scripts but the standard shell script precautions are not being taken. Me and a colleague encountered a quite strange failure mode this morning trying to run the image. Removing the first couple HereDocs and just using a lot of RUN commands solved it but adding set -euxo pipefail to every HereDoc should also make the Dockerfile more robust..

Can not run check_compliance.py from zephyr

I started docker container with the following command:
docker run -it nordicplayground/nrfconnect-sdk:main /bin/bash
next, inside the container, I created a shell script that only runs the zephyr/scripts/ci/check_compliance.py.
I run this script with the following command
nrfutil toolchain-manager launch bash -- tests.sh
This resulted with an error
ImportError: libffi.so.7: cannot open shared object file: No such file or directory

It seems like there are missing dependencies in the latest solution

Clean up to reduce image size

Hi,

I would like to suggest to clean stuff up to reduce the image size.

In particular:

  • APT / DPKG cache and package lists
  • Remove ~/ncs/... cache and download directory. The whole .tar.gz toolchain is kept around and eats a lot of memory

Speaking of which, is it intended that the toolchain is installed in ~/ncs/? The Dockerfile mentions

the image will be launched with the home dir mounted from the local checkout.

in a comment.

Debugging build after flashing

Hi, I've set up working containers for my team to build and flash programs to our dev boards, but am getting stuck on debugging. We mostly use nRF Development Kits like nrf52840DK, nordic tools (VS Code extensions, nrf Connect), and JLink while developing. However, after building and flashing, when I try to do west debug or attach, the program seems to be looking for files from the container (/workdir/...), which isn't present on the local side since we are using Macs and cannot flash inside the container. I'm wondering if anyone has done similar things and could offer some help, or if there's a guide on debugging with the nrf docker. Thanks a lot!
Screenshot 2023-03-14 at 2 51 10 PM

GCC missing for native_sim target

I believe this was fixed earlier in #56 but with the change to use nrfutil toolchain-manager this was removed (#75)

Would it be possible to add back the gcc-multilib package?

Switch to nrfutil toolchain-manager breaks prior build pipelines

After the updates brought through in #75, our CI/CD pipelines were failing due to the chain from Zephyr to the nrfutil toolchain manager. For instance, we saw the following

$ZEPHYR_BASE/scripts/twister -p native_posix --testsuite-root ./app/tests
bash: /scripts/twister: No such file or directory

This has also come with an increase in build image size from 3.64GB to 9.11GB, which greatly increased the time for our pipelines to run.

For other users: we resolved this by changing our image from the :v2.2-branch to a previously working image (in our case nordicplayground/nrfconnect-sdk@sha256:cb56598a977a2a615634417bcf4107752646b0a1c5dba373eaf8d01633455d8b, this will obviously change depending on what toolchain version was being used).

Recommendation would be for there to be some information about how to use the new images to create CI/CD pipelines.

Docker as a Base Image Problem on Gitlab CI/CD

As I mentioned on here, after that commit, we have to do some extra things in order to run your docker as a base image on Gitlab CI/CD. Before that commit, everything was straightforward. Is there a possibility to implement this things on Dockerfile directly? Thus, it will be again straightforward.

Docker fails on GitLab CI/CD

Hello.

I have been using this docker image for months in the gitlab ci/cd without any problems. However, since the last update, I have been getting the following error and I have no idea of whats going on:

image

Best regards

Zephyr toolchain version - Reproducible builds

I am attempting to have reproducible builds from my ci/cd and my development machine with this docker image. I noticed that the Zephyr toolchain version is 0.15.1

ZEPHYR_TOOLCHAIN_URL="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.1/zephyr-sdk-0.15.1_linux-x86_64.tar.gz" \

On my Windows machine I have installed the Nordic connect SDK (v2.0.0) and Zephyr SDK through the NRF Connect for Desktop software. I noticed that the zephyr toolchain that I have installed is v0.14.1. This version includes GCC-ARM v10. However, the docker image includes toolchain v0.15.1 which has GCC-ARM v12.

I would like to know how can I change the toolchain version so it matches my development machine. I think that for the NRF Connect SDK v2.0.0 the zephyr toolchain version is 0.14.1 right?

Further details on how I run this docker container on my ci/cd

west init -m https://github.com/nrfconnect/sdk-nrf/ --mr v2.0.0
west update --narrow -o=--depth=1
west build MY_PROJECT_DIR --board MY_BOARD

macOS M1 docker build fails

% docker build -t nrfconnect-sdk --build-arg sdk_nrf_revision=v2.1-branch --build-arg arch=arm64 .
...

#7 245.4 Target architecture: arm64
#7 245.4 Zephyr Toolchain version: 0.15.1
#7 245.4 ZEPHYR_TOOLCHAIN_URL=https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.1/zephyr-sdk-0.15.1_macos-aarch64.tar.gz
#7 528.9 Zephyr SDK 0.15.1 Setup
#7 528.9 
#7 528.9 ** NOTE **
#7 528.9 You only need to run this script once after extracting the Zephyr SDK
#7 528.9 distribution bundle archive.
#7 528.9 
#7 528.9 
#7 528.9 Installing host tools ...
#7 528.9 ./setup.sh: line 258: ./zephyr-sdk-aarch64-hosttools-standalone-0.9.sh: No such file or directory
#7 528.9 ERROR: Host tools installation failed
------
executor failed running [/bin/sh -c mkdir /workdir/project &&     mkdir /workdir/.cache &&     apt-get -y update &&     apt-get -y upgrade &&     apt-get -y install         wget         python3-pip         python3-venv         ninja-build         gperf         git         unzip         libncurses5 libncurses5-dev         libyaml-dev libfdt1         libusb-1.0-0-dev udev         device-tree-compiler=1.5.1-1         ruby &&     apt-get -y clean && apt-get -y autoremove &&     python3 -m pip install -U pip &&     python3 -m pip install -U pipx &&     python3 -m pip install -U setuptools &&     python3 -m pip install 'cmake>=3.20.0' wheel &&     python3 -m pip install -U "west==${WEST_VERSION}" &&     python3 -m pip install pc_ble_driver_py &&     python3 -m pip install --ignore-installed -U PyYAML &&     case $arch in     "amd64")         PIPX_HOME=/opt/pipx PIPX_BIN_DIR=/usr/local/bin         pipx install "nrfutil==${NRF_UTIL_VERSION}"         ;;     esac &&     python3 -m pip install -U six &&     apt-get -y install clang-format-9 &&     ln -s /usr/bin/clang-format-9 /usr/bin/clang-format &&     wget -qO- https://raw.githubusercontent.com/nrfconnect/sdk-nrf/main/.clang-format > /workdir/.clang-format &&     echo "Target architecture: $arch" &&     case $arch in         "amd64")             NCLT_URL="https://www.nordicsemi.com/-/media/Software-and-other-downloads/Desktop-software/nRF-command-line-tools/sw/${NORDIC_COMMAND_LINE_TOOLS_VERSION}_Linux-amd64.tar.gz"             ;;         "arm64")             NCLT_URL="https://www.nordicsemi.com/-/media/Software-and-other-downloads/Desktop-software/nRF-command-line-tools/sw/${NORDIC_COMMAND_LINE_TOOLS_VERSION}_Linux-arm64.tar.gz"             ;;     esac &&     echo "NCLT_URL=${NCLT_URL}" &&     if [ ! -z "$NCLT_URL" ]; then         mkdir tmp && cd tmp &&         wget -qO - "${NCLT_URL}" | tar --no-same-owner -xz &&         DEBIAN_FRONTEND=noninteractive apt-get -y install ./*.deb &&         cp -r ./nrf-command-line-tools /opt &&         ln -s /opt/nrf-command-line-tools/bin/nrfjprog /usr/local/bin/nrfjprog &&         ln -s /opt/nrf-command-line-tools/bin/mergehex /usr/local/bin/mergehex &&         cd .. && rm -rf tmp ;     else         echo "Skipping nRF Command Line Tools (not available for $arch)" ;     fi &&     echo "Target architecture: $arch" &&     echo "Zephyr Toolchain version: ${ZEPHYR_TOOLCHAIN_VERSION}" &&     case $arch in         "amd64")             ZEPHYR_TOOLCHAIN_URL="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_TOOLCHAIN_VERSION}/zephyr-sdk-${ZEPHYR_TOOLCHAIN_VERSION}_linux-x86_64.tar.gz"             ;;         "arm64")             ZEPHYR_TOOLCHAIN_URL="https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZEPHYR_TOOLCHAIN_VERSION}/zephyr-sdk-${ZEPHYR_TOOLCHAIN_VERSION}_macos-aarch64.tar.gz"             ;;         *)             echo "Unsupported target architecture: \"$arch\"" >&2 &&             exit 1 ;;     esac &&     echo "ZEPHYR_TOOLCHAIN_URL=${ZEPHYR_TOOLCHAIN_URL}" &&     wget -qO - "${ZEPHYR_TOOLCHAIN_URL}" | tar xz &&     mv /workdir/zephyr-sdk-${ZEPHYR_TOOLCHAIN_VERSION} /workdir/zephyr-sdk && cd /workdir/zephyr-sdk && yes | ./setup.sh]: exit code: 30

Building image with `--build-arg arch=arm64` fails

I ran docker build -t nrfconnect-sdk --build-arg sdk_nrf_revision=v2.3-branch --build-arg arch=arm64 . on my Mac with Apple Silicon. The build fails while executing this line:

python3 -m pip install -r zephyr/scripts/requirements.txt && \

I've attached the output of the docker build command to this issue. Apparently, Docker failed to

build wheels for clang-format, which is required to install pyproject.toml-based projects

Use Zephyr SDK toolchain

nRF Connect SDK 2.0.0 switches to the Zephyr toolchain:

The Zephyr SDK toolchain replaces the GNU ARM Embedded toolchain.

Implement this in the image for 2.0 branch and main.

build tagged versions of ncs that never changes

I have seen that all docker images are rebuild daily, I would like to have a docker image based on git tag of NCS, that does not change once it is build. This would help me with using the docker image as VSCode devcontainer for day to day work.
And would save some space on My PC if I were to use this docker images for day to day work ( I woudn't need to donwload new images every day)

nrfutil 6 is not compatible with aarch64

Building the container on aarch64 results in nrfutil 5.2.0 being installed, which cannot run under python3 and fails.

sudo docker run --rm nrfconnect-sdk nrfutil version
nrfutil version 5.2.0

Doing the same under amd64 results in nrfutil 6.1.7.

Prebuilt disclaimer clarification?

Hello,

I've been interested in producing a smoke test pipeline for Zephyr projects and noticed the prebuilt image in the Nordic assets dockerhub.

The Readme suggests this is a third party image being hosted that can potentially leak source code.

What is the meaning of this? Is NordicPlayground not managed by Nordic engineers? If so, what makes building the image from the repository any safer than using the prebuilt?

Thanks

Conflict in READMEmd - Building image locally: nrf-docker vs nrfconnect-skd

The paragraph Building image locally at moment:

Clone the repo:

git clone https://github.com/NordicPlayground/nrf-docker

Build the image (this is only needed once):

cd nrfconnect-sdk
docker build -t nrfconnect-sdk --build-arg sdk_nrf_revision=v1.9-branch .

My assumption is that the above lines should be
cd nrf-docker
docker build -t nrfconnect-sdk --build-arg sdk_nrf_revision=v1.9-branch .

Similar conflict in the Full example.
# build docker image
git clone https://github.com/NordicPlayground/nrf-docker
cd nrfconnect-sdk
docker build -t nrfconnect-sdk --build-arg sdk_nrf_revision=v1.9-branch .
cd ..

Add Windows examples

Some developers use Windows, and here the Docker container can be useful as well.

Provide examples (and tests) that show how to use the Docker image on Windows.

Provide option to not install NCS

Applications using a West T2 project topology (a.k.a. "Workflow 4" according to Nordic docs) would be downloading their own NCS repo with west in a typical CI/CD situation.

Specifically to our case, we use GitLab CI and we get the manifest repo downloaded before the CI script starts running, so the pre-existing NCS is both a waste of space and an inconvenience.
Sure, we could use the pre-installed NCS if we made sure to pull the docker image that matches the NCS version referenced in our manifest, but that defeats the some of the benefits of the T2 topology, e.g.:

  • it means that we can't override repos from the NCS manifest to bring in custom changes from our own forks
  • it means that we can't update our project to a newer version of the NCS until this repo is updated to it and a new image generated

Our first approach was to start our CI script with:

  • removing the NCS west workspace
  • west init -l in the manifest repo that is being built
  • west update --narrow -o=--depth=1
  • redefine ZEPHYR_BASE
  • start the west build

This works, but it's wasteful of space and slow.

Our second attempt was to fork this repo to remove the NCS installation from the Dockerfile (lines 129:155), then in the CI script:

  • pull the new "NCS-less" docker image
  • west init -l in the manifest repo that is being built
  • west update --narrow -o=--depth=1, which gets the NCS and various repos from the manifest on disk
  • install the python requirements from the zephyr, nrf and bootloader directories
  • start the west build

This means that the project is built with the NCS and all other dependencies as defined in the project's manifest.
The drawback is that the python requirements need to be installed as part of the build, which takes some time (but can be cached at the CI level)

In short:

  • is there a better way (that I couldn't figure out) to use this docker image with a T2 topology?
  • if the answer is "no, there isn't", I offer to create a PR that makes the installation of NCS conditional to a Dockerfile ARG (I propose the installation is on by default, and the ARG allows skipping it) and explains in README.md how to use this feature. I would like to first check that this approach makes sense, though =)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.