Skip to content

Commit

Permalink
[docker: chip-buid] make image slightly smaller (#29763)
Browse files Browse the repository at this point in the history
* Some cleanup and strips on the chip-build image

* Restyle

---------

Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Feb 2, 2024
1 parent 2df6b8a commit 3454173
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions integrations/docker/images/base/chip-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ RUN set -x \
meson \
net-tools \
ninja-build \
openjdk-8-jdk \
pkg-config \
python-is-python3 \
python3.9 \
Expand Down Expand Up @@ -172,8 +171,9 @@ RUN set -x \
&& git clone https://github.com/google/bloaty.git \
&& mkdir -p bloaty/build \
&& cd bloaty/build \
&& cmake ../ \
&& cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../ \
&& make -j8 \
&& strip bloaty \
&& make install \
&& cd ../.. \
&& rm -rf bloaty \
Expand All @@ -188,8 +188,9 @@ RUN set -x \
&& git clone --depth=1 --branch=clang_12 https://github.com/include-what-you-use/include-what-you-use.git \
&& mkdir -p include-what-you-use/build \
&& cd include-what-you-use/build \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr/lib/llvm-12 -DIWYU_LINK_CLANG_DYLIB=OFF .. \
&& cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr/lib/llvm-12 -DIWYU_LINK_CLANG_DYLIB=OFF .. \
&& make -j8 \
&& strip bin/include-what-you-use \
&& make install \
# Save clang-12 files, so we can restore them after build dependencies cleanup
&& tar -cf clang-12-files.tar $(dpkg -L libclang-common-12-dev |grep /include) /usr/lib/llvm-12/lib/libLLVM-12.so.1 \
Expand Down Expand Up @@ -259,3 +260,12 @@ RUN case ${TARGETPLATFORM} in \
&& cd .. \
&& rm -rf node_js \
&& : # last line

# Some things that save space
# Protoc goes from 108M to 4.6M
RUN strip /usr/local/bin/protoc*

# CMake documentation not needed, saves 34MB
# /usr/local/man contains cmake documentation
RUN rm -rf /usr/local/doc/cmake
RUN rm -rf /usr/local/man
2 changes: 1 addition & 1 deletion integrations/docker/images/base/chip-build/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19 : [Silabs] Remove unnecessary files from the gecko-sdk for the docker image
20 : [Chip-build] Decrease some image sizes

0 comments on commit 3454173

Please sign in to comment.