@@ -12,6 +12,9 @@ ARG UBUNTU_MIRROR_PORTS=ports.ubuntu.com/ubuntu-ports
1212
1313ARG ZSDK_VERSION=0.17.4
1414ENV ZSDK_VERSION=$ZSDK_VERSION
15+ # Limit installed SDK content to the toolchains used by ZSWatch to keep the image lean.
16+ ARG ZSDK_TOOLCHAINS="arm-zephyr-eabi,x86_64-zephyr-elf"
17+ ENV ZSDK_TOOLCHAINS=$ZSDK_TOOLCHAINS
1518
1619# Install minimal extra APT packages required for ZSWatch CI
1720RUN <<EOF
@@ -24,14 +27,43 @@ RUN <<EOF
2427 rm -rf /var/lib/apt/lists/*
2528EOF
2629
30+ # Remove large tooling from ci-base that ZSWatch does not need (keeps image small)
31+ RUN <<'EOF'
32+ if [ "${HOSTTYPE}" = "x86_64" ]; then
33+ # Drop 32-bit support and multilib toolchains not needed for nRF/native_sim_64
34+ apt-get purge --auto-remove -y \
35+ gcc-multilib g++-multilib \
36+ libc6-dbg:i386 libfuse-dev:i386 libsdl2-dev:i386 || true
37+ dpkg --remove-architecture i386 || true
38+ fi
39+
40+ # Remove heavy debug/coverage/doc tools unused in ZSWatch CI builds
41+ apt-get purge --auto-remove -y \
42+ valgrind \
43+ lcov \
44+ gcovr \
45+ doxygen \
46+ thrift-compiler || true
47+
48+ apt-get clean -y
49+ rm -rf /var/lib/apt/lists/*
50+ EOF
51+
2752# Install Zephyr SDK
2853RUN <<EOF
2954 mkdir -p /opt/toolchains
3055 cd /opt/toolchains
3156 wget ${WGET_ARGS} https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/zephyr-sdk-${ZSDK_VERSION}_linux-${HOSTTYPE}.tar.xz
3257 tar xf zephyr-sdk-${ZSDK_VERSION}_linux-${HOSTTYPE}.tar.xz
33- zephyr-sdk-${ZSDK_VERSION}/setup.sh -t all -h -c
58+ # Convert comma/space separated toolchain list into repeated -t flags (required by setup.sh)
59+ set --
60+ for toolchain in $(printf '%s' "$ZSDK_TOOLCHAINS" | tr ',' ' '); do
61+ set -- "$@" -t "$toolchain"
62+ done
63+ set -- "$@" -h -c
64+ zephyr-sdk-${ZSDK_VERSION}/setup.sh "$@"
3465 rm zephyr-sdk-${ZSDK_VERSION}_linux-${HOSTTYPE}.tar.xz
66+ find zephyr-sdk-${ZSDK_VERSION}/sysroots -maxdepth 4 -type d \( -name doc -o -name man -o -name info \) -exec rm -rf '{}' +
3567EOF
3668
3769# Run the Zephyr SDK setup script as 'user' in order to ensure that the
0 commit comments