Skip to content

Commit 65b3993

Browse files
committed
Make image smaller by removing stuff we don't need.
1 parent cba8e36 commit 65b3993

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

Dockerfile.zswatch-ci

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ ARG UBUNTU_MIRROR_PORTS=ports.ubuntu.com/ubuntu-ports
1212

1313
ARG ZSDK_VERSION=0.17.4
1414
ENV 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
1720
RUN <<EOF
@@ -24,14 +27,37 @@ RUN <<EOF
2427
rm -rf /var/lib/apt/lists/*
2528
EOF
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
2853
RUN <<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+
zephyr-sdk-${ZSDK_VERSION}/setup.sh -t "${ZSDK_TOOLCHAINS}" -h -c
3459
rm zephyr-sdk-${ZSDK_VERSION}_linux-${HOSTTYPE}.tar.xz
60+
find zephyr-sdk-${ZSDK_VERSION}/sysroots -maxdepth 4 -type d \( -name doc -o -name man -o -name info \) -exec rm -rf '{}' +
3561
EOF
3662

3763
# Run the Zephyr SDK setup script as 'user' in order to ensure that the

0 commit comments

Comments
 (0)