Add dockerfile for NuttX platform compile (#31341)

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
Co-authored-by: Andrei Litvin <andy314@gmail.com>
diff --git a/integrations/docker/images/base/chip-build/version b/integrations/docker/images/base/chip-build/version
index bfe684b..498993f 100644
--- a/integrations/docker/images/base/chip-build/version
+++ b/integrations/docker/images/base/chip-build/version
@@ -1 +1 @@
-39 : [Python] Add ruff Python linter to chip-build
+40 : [NuttX] Add support for NuttX SDK
diff --git a/integrations/docker/images/stage-2/chip-build-nuttx/Dockerfile b/integrations/docker/images/stage-2/chip-build-nuttx/Dockerfile
new file mode 100644
index 0000000..0912ea4
--- /dev/null
+++ b/integrations/docker/images/stage-2/chip-build-nuttx/Dockerfile
@@ -0,0 +1,41 @@
+ARG VERSION=1
+FROM ghcr.io/project-chip/chip-build:${VERSION}
+LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip
+
+# ------------------------------------------------------------------------------
+# Install prerequisites
+RUN set -x \
+    && dpkg --add-architecture i386 \
+    && apt update -y \
+    && apt install -y genromfs xxd libgmp-dev libmpfr-dev libmpc-dev \
+    && : # last line
+
+# ------------------------------------------------------------------------------
+# Download and build g++-13
+RUN set -x \
+    && ! test -d /opt/nuttx/gcc-13 \
+    && wget -P gcc_build https://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-13.1.0/gcc-13.1.0.tar.gz \
+    && cd gcc_build \
+    && tar xzf gcc-13.1.0.tar.gz \
+    && cd gcc-13.1.0 \
+    && ./configure --prefix=/opt/nuttx/gcc-13 --disable-multilib \
+    && make -j8 \
+    && make install-strip \
+    && rm -rf ../../gcc_build \
+    && : # last line
+
+# ------------------------------------------------------------------------------
+# Download NuttX SDK
+RUN set -x \
+    && cd /opt/nuttx \
+    && wget -q -O nuttx.zip https://codeload.github.com/apache/nuttx/zip/b8e0423 \
+    && unzip -q nuttx.zip \
+    && mv nuttx-b8e0423 nuttx \
+    && rm nuttx.zip
+
+RUN set -x \
+    && cd /opt/nuttx \
+    && wget -q -O nuttx_app.zip https://codeload.github.com/apache/nuttx-apps/zip/9c48a8d \
+    && unzip -q nuttx_app.zip \
+    && mv nuttx-apps-9c48a8d apps \
+    && rm nuttx_app.zip
diff --git a/integrations/docker/images/stage-2/chip-build-nuttx/build.sh b/integrations/docker/images/stage-2/chip-build-nuttx/build.sh
new file mode 120000
index 0000000..46b2031
--- /dev/null
+++ b/integrations/docker/images/stage-2/chip-build-nuttx/build.sh
@@ -0,0 +1 @@
+../../../build.sh
\ No newline at end of file
diff --git a/integrations/docker/images/stage-2/chip-build-nuttx/run.sh b/integrations/docker/images/stage-2/chip-build-nuttx/run.sh
new file mode 120000
index 0000000..9bbfad8
--- /dev/null
+++ b/integrations/docker/images/stage-2/chip-build-nuttx/run.sh
@@ -0,0 +1 @@
+../../../run.sh
\ No newline at end of file
diff --git a/integrations/docker/images/stage-2/chip-build-nuttx/version b/integrations/docker/images/stage-2/chip-build-nuttx/version
new file mode 120000
index 0000000..a40ba48
--- /dev/null
+++ b/integrations/docker/images/stage-2/chip-build-nuttx/version
@@ -0,0 +1 @@
+../../base/chip-build/version
\ No newline at end of file
diff --git a/integrations/docker/images/vscode/chip-build-vscode/Dockerfile b/integrations/docker/images/vscode/chip-build-vscode/Dockerfile
index 91e9a9b..83556ee 100644
--- a/integrations/docker/images/vscode/chip-build-vscode/Dockerfile
+++ b/integrations/docker/images/vscode/chip-build-vscode/Dockerfile
@@ -17,6 +17,7 @@
 FROM ghcr.io/project-chip/chip-build-openiotsdk:${VERSION} AS openiotsdk
 FROM ghcr.io/project-chip/chip-build-bouffalolab:${VERSION} AS bouffalolab
 FROM ghcr.io/project-chip/chip-build-asr:${VERSION} AS asr
+FROM ghcr.io/project-chip/chip-build-nuttx:${VERSION} AS nuttx
 FROM ghcr.io/project-chip/chip-build:${VERSION}
 
 LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip
@@ -67,6 +68,8 @@
 COPY --from=efr32 /opt/silabs/wiseconnect-wifi-bt-sdk /opt/silabs/wiseconnect-wifi-bt-sdk
 COPY --from=efr32 /opt/silabs/wifi_sdk /opt/silabs/wifi_sdk
 
+COPY --from=nuttx /opt/nuttx /opt/nuttx
+
 # Android license file "acceping" is done by writing license hashes
 # into the 'licenses' subfolder. This allows any user (in particular
 # 'vscode' to accept licenses)