Skip to content

Commit a0c133b

Browse files
[nrfconnect] Fix nRF Connect SDK docker image. (project-chip#39985)
Created a symlink to the latest Zephyr-sdk toolchain, fixed Python environment and exported environment variables required by all nRF Connect-related builds. Signed-off-by: Arkadiusz Balys <[email protected]>
1 parent ad2e3f5 commit a0c133b

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
148 : Update docker image to add ffmpeg, curl dev packages for cross compile
1+
149 : [nrfconnect] Fix nRF Connect SDK docker image.

integrations/docker/images/stage-2/chip-build-nrf-platform/Dockerfile

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG VERSION=1
22

3-
FROM ghcr.io/project-chip/chip-build:${VERSION} as build
3+
FROM ghcr.io/project-chip/chip-build:${VERSION} AS build
44

55
# Compatible Nordic Connect SDK revision and required tools versions
66
ARG NCS_REVISION=v3.0.0
@@ -61,8 +61,25 @@ ENV ZEPHYR_BASE=/opt/NordicSemiconductor/nrfconnect/zephyr
6161
# Set up Zephyr SDK environment variables
6262
RUN set -x \
6363
# Setup Zephyr SDK environment variables
64-
# Do not use the nrfconnect python environment because the python environment should be created by bootstrap.sh
65-
&& nrfutil sdk-manager toolchain env --as-script --ncs-version "$NCS_REVISION" --install-dir ${NRF5_TOOLS_ROOT}/zephyr-sdk | grep -v "PYTHONHOME\|PYTHONPATH" | tee -a /root/.bashrc \
64+
&& nrfutil sdk-manager toolchain env --as-script --ncs-version "$NCS_REVISION" --install-dir ${NRF5_TOOLS_ROOT}/zephyr-sdk > $ZEPHYR_BASE/zephyr-env.sh \
65+
&& echo "source $ZEPHYR_BASE/zephyr-env.sh" >> /etc/bash.bashrc \
66+
# Create a symlink named "latest" pointing to the toolchain directory to avoid hash in the path
67+
&& source $ZEPHYR_BASE/zephyr-env.sh \
68+
&& ln -s ${ZEPHYR_SDK_INSTALL_DIR} ${NRF5_TOOLS_ROOT}/zephyr-sdk/toolchains/latest \
6669
# Remove redundant directory created by nrfutil
6770
&& rm -rf ${NRF5_TOOLS_ROOT}/zephyr-sdk/downloads \
6871
&& : # last line
72+
73+
# Install Zephyr and nRF Connect SDK requirements
74+
RUN set -x \
75+
&& source $ZEPHYR_BASE/zephyr-env.sh \
76+
&& python3 -m pip install -v --no-build-isolation --no-cache-dir -r /opt/NordicSemiconductor/nrfconnect/zephyr/scripts/requirements-base.txt \
77+
&& python3 -m pip install -v --no-build-isolation --no-cache-dir -r /opt/NordicSemiconductor/nrfconnect/nrf/scripts/requirements-build.txt \
78+
&& python3 -m pip install -v --no-build-isolation --no-cache-dir -r /opt/NordicSemiconductor/nrfconnect/bootloader/mcuboot/scripts/requirements.txt \
79+
&& python3 -m pip install -v --no-build-isolation --no-cache-dir -r /opt/NordicSemiconductor/nrfconnect/modules/lib/matter/scripts/setup/requirements.nrfconnect.txt \
80+
# Remove protobuf to avoid version conflict
81+
&& python3 -m pip uninstall -y protobuf \
82+
&& : # last line
83+
84+
ENV ZEPHYR_TOOLCHAIN_VARIANT=zephyr
85+
ENV ZEPHYR_SDK_INSTALL_DIR=${NRF5_TOOLS_ROOT}/zephyr-sdk/toolchains/latest/opt/zephyr-sdk

integrations/docker/images/vscode/chip-build-vscode/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ ENV TELINK_ZEPHYR_BASE=/opt/telink/zephyrproject/zephyr
129129
ENV TELINK_ZEPHYR_SDK_DIR=/opt/telink/zephyr-sdk-0.17.0
130130
ENV TI_SYSCONFIG_ROOT=/opt/ti/sysconfig_1.22.0
131131
ENV ZEPHYR_BASE=/opt/NordicSemiconductor/nrfconnect/zephyr
132-
ENV ZEPHYR_SDK_INSTALL_DIR=/opt/NordicSemiconductor/nRF5_tools/zephyr-sdk-0.17.0
132+
ENV ZEPHYR_SDK_INSTALL_DIR=/opt/NordicSemiconductor/nRF5_tools/zephyr-sdk/toolchains/latest/opt/zephyr-sdk
133133
ENV ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
134134
ENV ZEPHYR_NXP_BASE=/opt/nxp-zephyr/zephyrproject/zephyr
135135
ENV ZEPHYR_NXP_SDK_INSTALL_DIR=/opt/nxp-zephyr/zephyr-sdk-0.17.0

0 commit comments

Comments
 (0)