Skip to content

Commit ffc5727

Browse files
andy31415andreilitvinmbknustjlatusek
authored
Update Dockerfiles to ubuntu:24.04 (#33637)
* Update to ubuntu 24.04 and bump version * Fix comment * Dependencies update * Use the latest gcc by default * Fix up clang save & cleanup * More build fixes * Add more --break-system-packages * Do not remove libllvm17t64 ... I am unsure about that one * Remove it after all ... seems some size savings here * More cleanup * Drop alternative install * Install gcc without a specific version. Undoes #28478 * Need llvm18-dev as well * Update to lib64 paths * Also install xz * xz is in utils * Fix asr depends when no recommends is installed * Clean up infineon, make the curl download to NOT be silent * using -j8 is arbitrary ... use nproc instead * update what qemu means * Install patch for the qemu image build * Adapt Tizen Dockerfiles * Update ubuntu version * Update Dockerfile for chip-build-linux-qemu image * Restyle * Add ability to skip already built things, otherwise docker keeps re-building stuff * Docker image inspect is MUCH faster than docker images * Fix nrf build * Fix ameba dockerfile build * Fix cirque image build * Make imx image work * Make build ordering predictable * Fix k32w image build * Fix telink image build * Speed up android image build by a lot * Bump up espressif qemu build, do not use the 3-year old version * Update versions to match system package versions, so that bootstrap is faster * Make sure that patch is available in the base image, we seem to use it ocassionally * One documentation update * Also allow compilation of mbedos bits in the vscode image * Include what you use from system --------- Co-authored-by: Andrei Litvin <andreilitvin@google.com> Co-authored-by: Maksymilian Knust <m.knust@samsung.com> Co-authored-by: Jakub Latusek <j.latusek@samsung.com>
1 parent 1cbcc5c commit ffc5727

File tree

26 files changed

+224
-231
lines changed

26 files changed

+224
-231
lines changed

integrations/docker/build-all.sh

+25-2
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,33 @@ set -e
2525

2626
SUB_PATH="*"
2727
ALL_ARGS=""
28+
SKIP_BUILT=0
2829

2930
for i in "$@"; do
3031
case $i in
32+
-h | --help)
33+
echo "Supported arguments:"
34+
echo " -h/--help This help text"
35+
echo " -p/--path sub-path in integrations/docker/images to build (defaults to * for everything)"
36+
echo " -skip-built Do not rebuild images already found as built"
37+
exit 0
38+
;;
3139
-p=* | --path=*)
3240
SUB_PATH="${i#*=}"
3341
;;
42+
--skip-built)
43+
SKIP_BUILT=1
44+
;;
3445
*)
3546
ALL_ARGS="$ALL_ARGS ${i#*=}"
3647
;;
3748
esac
3849
done
3950

51+
VERSION=${DOCKER_BUILD_VERSION:-$(sed 's/ .*//' "$(git rev-parse --show-toplevel)"/integrations/docker/images/base/chip-build/version)}
52+
4053
echo "SUB_PATH: $SUB_PATH"
54+
echo "VERSION: $VERSION"
4155

4256
function build_image() {
4357
PARSE_PATH=$1
@@ -46,8 +60,17 @@ function build_image() {
4660
echo "PARSE_PATH: $PARSE_PATH"
4761
echo "ARGS_TO_PASS: $ARGS_TO_PASS"
4862

49-
find "$(git rev-parse --show-toplevel)"/integrations/docker/images/$PARSE_PATH -name Dockerfile ! -path "*chip-cert-bins/*" | while read -r dockerfile; do
50-
echo "$(dirname "$dockerfile")"
63+
find "$(git rev-parse --show-toplevel)"/integrations/docker/images/$PARSE_PATH -name Dockerfile ! -path "*chip-cert-bins/*" | sort | while read -r dockerfile; do
64+
# Images are of the form `ghcr.io/project-chip/{name}` and tagged as "${VERSION}"
65+
DOCKER_PATH=$(dirname $dockerfile) # Drop the file name
66+
IMAGE_NAME="ghcr.io/project-chip/${DOCKER_PATH##*/}:${VERSION}" # Drop directory prefix
67+
68+
if [ $SKIP_BUILT -ne 0 ] && docker image inspect "${IMAGE_NAME}" >/dev/null 2>&1; then
69+
echo "Image ${IMAGE_NAME} already exists. Skipping build"
70+
continue
71+
fi
72+
73+
echo "BUILDING $(dirname "$dockerfile") (i.e. ${IMAGE_NAME})"
5174
pushd "$(dirname "$dockerfile")" >/dev/null
5275
./build.sh "$ARGS_TO_PASS"
5376
popd >/dev/null

integrations/docker/images/base/chip-build-minimal/Dockerfile

+7-15
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
11
# This minimal build image is intentionally not based on chip-build
2-
FROM ubuntu:focal
2+
FROM ubuntu:24.04
33
LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip
44

5-
# ARG NINJA_VERSION=v1.11.1
6-
ARG GN_HASH=5a004f9427a050c6c393c07ddb85cba8ff3849fa
7-
85
RUN set -x \
96
&& apt-get update \
107
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \
118
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
12-
build-essential ca-certificates git pkg-config python3-venv ninja-build \
9+
build-essential \
10+
ca-certificates \
11+
generate-ninja \
12+
git pkg-config \
13+
ninja-build \
14+
python3-venv \
1315
&& git config --global advice.detachedHead false
1416

15-
# RUN set -x && cd /var/tmp \
16-
# && git clone --branch "$NINJA_VERSION" https://github.com/ninja-build/ninja.git \
17-
# && ( cd ninja && ./configure.py --bootstrap && install -m 0755 ninja /usr/local/bin/ ) \
18-
# && rm -rf ninja
19-
20-
RUN set -x && cd /var/tmp \
21-
&& git clone https://gn.googlesource.com/gn \
22-
&& ( cd gn && git checkout "$GN_HASH" && CXX=g++ build/gen.py && ninja -C out && install -m 0755 out/gn /usr/local/bin/ ) \
23-
&& rm -rf gn
24-
2517
# CHIP build dependencies
2618
RUN set -x \
2719
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# start with Ubuntu 20.04LTS
2-
FROM ubuntu:focal
1+
FROM ubuntu:24.04
32
LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip
43

54
VOLUME "/var/source"
@@ -30,7 +29,7 @@ RUN case ${TARGETPLATFORM} in \
3029
# base build and check tools and libraries layer
3130
RUN set -x \
3231
&& apt-get update \
33-
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --fix-missing \
32+
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --fix-missing --no-install-recommends \
3433
autoconf \
3534
automake \
3635
bison \
@@ -39,23 +38,27 @@ RUN set -x \
3938
clang \
4039
clang-format \
4140
clang-tidy \
41+
cmake \
4242
curl \
4343
flex \
44-
g++-10 \
44+
g++ \
45+
generate-ninja \
4546
git \
4647
git-lfs \
4748
gperf \
4849
iproute2 \
50+
iwyu \
4951
jq \
5052
lcov \
5153
libavahi-client-dev \
5254
libavahi-common-dev \
53-
libcairo-dev \
5455
libcairo2-dev \
56+
libcairo-dev \
5557
libdbus-1-dev \
5658
libdbus-glib-1-dev \
5759
libdmalloc-dev \
5860
libgif-dev \
61+
libgirepository-1.0-1 \
5962
libglib2.0-dev \
6063
libical-dev \
6164
libjpeg-dev \
@@ -68,8 +71,8 @@ RUN set -x \
6871
libpango1.0-dev \
6972
libpixman-1-dev \
7073
libreadline-dev \
71-
libsdl-pango-dev \
7274
libsdl2-dev \
75+
libsdl-pango-dev \
7376
libssl-dev \
7477
libtool \
7578
libudev-dev \
@@ -80,11 +83,19 @@ RUN set -x \
8083
meson \
8184
net-tools \
8285
ninja-build \
86+
nodejs \
87+
patch \
8388
pkg-config \
89+
python3 \
90+
python3-click \
91+
python3-coloredlogs \
92+
python3-dev \
93+
python3-future \
94+
python3-pandas \
95+
python3-pip \
96+
python3-tabulate \
97+
python3-venv \
8498
python-is-python3 \
85-
python3.9 \
86-
python3.9-dev \
87-
python3.9-venv \
8899
rsync \
89100
shellcheck \
90101
strace \
@@ -97,73 +108,19 @@ RUN set -x \
97108
&& git lfs install \
98109
&& : # last line
99110

100-
# Set gcc 10 as a default compiler to work with TSAN
101-
RUN set -x \
102-
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 \
103-
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 \
104-
&& update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 \
105-
&& update-alternatives --set cc /usr/bin/gcc \
106-
&& update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 \
107-
&& update-alternatives --set c++ /usr/bin/g++ \
108-
&& : # last line
109-
110-
# Cmake v3.23.1
111-
ENV CMAKE_PLATFORM_VERSION=
112-
RUN case ${TARGETPLATFORM} in \
113-
"linux/amd64") CMAKE_PLATFORM_VERSION="x86_64";; \
114-
"linux/arm64") CMAKE_PLATFORM_VERSION="aarch64";; \
115-
*) \
116-
test -n "$TARGETPLATFORM" \
117-
echo "Unsupported platform ${TARGETPLATFORM}" \
118-
&& return 1 ;\
119-
;; \
120-
esac \
121-
&& set -x \
122-
&& (cd /tmp \
123-
&& wget --progress=dot:giga https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-Linux-$CMAKE_PLATFORM_VERSION.sh \
124-
&& sh cmake-3.23.1-Linux-$CMAKE_PLATFORM_VERSION.sh --exclude-subdir --prefix=/usr/local \
125-
&& rm -rf cmake-3.23.1-Linux-$CMAKE_PLATFORM_VERSION.sh) \
126-
&& exec bash \
127-
&& : # last line
128-
129-
# Python 3.9 and PIP
130-
RUN set -x \
131-
&& DEBIAN_FRONTEND=noninteractive apt-get update \
132-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y libgirepository1.0-dev \
133-
&& DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common \
134-
&& add-apt-repository universe \
135-
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
136-
&& python3.9 get-pip.py \
137-
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 \
138-
&& rm -rf /var/lib/apt/lists/ \
139-
&& : # last line
140-
111+
# NOTE: this install is NOT ideal as we are installing over system
112+
# we should migrate to venvs for packages we do not directly have
113+
# provided by the system
141114
RUN set -x \
142-
&& pip3 install --no-cache-dir \
115+
&& pip3 install --break-system-packages --no-cache-dir --break-system-packages \
143116
attrs \
144-
click \
145-
coloredlogs \
146117
cxxfilt \
147-
future \
148118
ghapi \
149119
mobly \
150-
pandas \
151120
portpicker \
152121
pygit \
153122
PyGithub \
154123
ruff \
155-
tabulate \
156-
&& : # last line
157-
158-
# build and install gn
159-
RUN set -x \
160-
&& git clone https://gn.googlesource.com/gn \
161-
&& cd gn \
162-
&& python3 build/gen.py \
163-
&& ninja -C out \
164-
&& cp out/gn /usr/local/bin \
165-
&& cd .. \
166-
&& rm -rf gn \
167124
&& : # last line
168125

169126
# Install bloat comparison tools
@@ -172,38 +129,13 @@ RUN set -x \
172129
&& mkdir -p bloaty/build \
173130
&& cd bloaty/build \
174131
&& cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../ \
175-
&& make -j8 \
132+
&& make -j$(nproc) \
176133
&& strip bloaty \
177134
&& make install \
178135
&& cd ../.. \
179136
&& rm -rf bloaty \
180137
&& : # last line
181138

182-
# Need newer version of include-what-you-use
183-
RUN set -x \
184-
&& apt-get update \
185-
# Install build and runtime requirements for IWYU
186-
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --fix-missing clang-12 libclang-12-dev \
187-
# Build and install IWYU
188-
&& git clone --depth=1 --branch=clang_12 https://github.com/include-what-you-use/include-what-you-use.git \
189-
&& mkdir -p include-what-you-use/build \
190-
&& cd include-what-you-use/build \
191-
&& cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr/lib/llvm-12 -DIWYU_LINK_CLANG_DYLIB=OFF .. \
192-
&& make -j8 \
193-
&& strip bin/include-what-you-use \
194-
&& make install \
195-
# Save clang-12 files, so we can restore them after build dependencies cleanup
196-
&& tar -cf clang-12-files.tar $(dpkg -L libclang-common-12-dev |grep /include) /usr/lib/llvm-12/lib/libLLVM-12.so.1 \
197-
# Cleanup build dependencies
198-
&& apt autopurge -fy clang-12 libclang-12-dev \
199-
&& rm -rf /var/lib/apt/lists/ \
200-
# Restore clang-12 files
201-
&& tar -xf clang-12-files.tar -C / \
202-
# Cleanup
203-
&& cd ../.. \
204-
&& rm -rf include-what-you-use \
205-
&& : # last line
206-
207139
# Build glib-2.0 from source with enabled thread sanitizer. This is needed for
208140
# running CHIP tests with TSAN enabled. When running applications with TSAN
209141
# all shared libraries should be built with TSAN enabled, otherwise TSAN might
@@ -219,7 +151,7 @@ RUN case ${TARGETPLATFORM} in \
219151
&& git clone --depth=1 --branch=$GLIB_VERSION https://github.com/GNOME/glib.git \
220152
&& CFLAGS="-O2 -g -fsanitize=thread" meson glib/build glib -Dtests=false \
221153
&& DESTDIR=../build-image ninja -C glib/build install \
222-
&& mv glib/build-image/usr/local/lib/x86_64-linux-gnu/lib* $LD_LIBRARY_PATH_TSAN \
154+
&& mv glib/build-image/usr/local/lib64/lib* $LD_LIBRARY_PATH_TSAN \
223155
&& rm -rf glib \
224156
;; \
225157
"linux/arm64") \
@@ -231,41 +163,6 @@ RUN case ${TARGETPLATFORM} in \
231163
;; \
232164
esac
233165

234-
# NodeJS: install a newer version than what apt-get would read
235-
# This installs the latest LTS version of nodejs
236-
#
237-
# NodeJS is required by github actions, we use Wandalen/wretry.action@v1.3.0
238-
# and that seems to use the built-in node installation in the image
239-
#
240-
# This is not a CHIP dependency directly, but used by CI
241-
ENV CHIP_NODE_VERSION=v16.13.2
242-
ENV NODE_PLATFORM_VERSION=
243-
RUN case ${TARGETPLATFORM} in \
244-
"linux/amd64") NODE_PLATFORM_VERSION=x64;; \
245-
"linux/arm64") NODE_PLATFORM_VERSION=arm64;; \
246-
*) \
247-
test -n "$TARGETPLATFORM" \
248-
echo "Unsupported platform ${TARGETPLATFORM}" \
249-
&& return 1 ;\
250-
;; \
251-
esac \
252-
&& set -x \
253-
&& mkdir node_js \
254-
&& cd node_js \
255-
&& wget https://nodejs.org/dist/$CHIP_NODE_VERSION/node-$CHIP_NODE_VERSION-linux-$NODE_PLATFORM_VERSION.tar.xz \
256-
&& tar xfvJ node-$CHIP_NODE_VERSION-linux-$NODE_PLATFORM_VERSION.tar.xz \
257-
&& mv node-$CHIP_NODE_VERSION-linux-$NODE_PLATFORM_VERSION /opt/ \
258-
&& ln -s /opt/node-$CHIP_NODE_VERSION-linux-$NODE_PLATFORM_VERSION /opt/node \
259-
&& ln -s /opt/node/bin/* /usr/bin \
260-
&& cd .. \
261-
&& rm -rf node_js \
262-
&& : # last line
263-
264166
# Some things that save space
265167
# Protoc goes from 108M to 4.6M
266168
RUN strip /usr/local/bin/protoc*
267-
268-
# CMake documentation not needed, saves 34MB
269-
# /usr/local/man contains cmake documentation
270-
RUN rm -rf /usr/local/doc/cmake
271-
RUN rm -rf /usr/local/man
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
54 : [Telink] Update Docker image (Zephyr update)
1+
55 : Update to Ubuntu 24.04 as the base build image

integrations/docker/images/chip-cert-bins/Dockerfile

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Stage 1: Setup dependencies (based on chip-build).
2-
FROM ubuntu:22.04 as chip-build-cert
2+
FROM ubuntu:24.04 as chip-build-cert
33
LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip
44
ARG TARGETPLATFORM
55
# COMMITHASH defines the target commit to build from. May be passed in using --build-arg.
@@ -292,12 +292,12 @@ COPY --from=chip-build-cert-bins /root/connectedhomeip/out/python_env python_env
292292
COPY --from=chip-build-cert-bins /root/connectedhomeip/src/python_testing python_testing
293293

294294
COPY --from=chip-build-cert-bins /root/connectedhomeip/scripts/tests/requirements.txt /tmp/requirements.txt
295-
RUN pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt
295+
RUN pip install --break-system-packages -r /tmp/requirements.txt && rm /tmp/requirements.txt
296296

297297
COPY --from=chip-build-cert-bins /root/connectedhomeip/src/python_testing/requirements.txt /tmp/requirements.txt
298-
RUN pip install -r /tmp/requirements.txt && rm /tmp/requirements.txt
298+
RUN pip install --break-system-packages -r /tmp/requirements.txt && rm /tmp/requirements.txt
299299

300300
# PIP requires MASON package compilation, which seems to require a JDK
301301
RUN set -x && DEBIAN_FRONTEND=noninteractive apt-get install -fy openjdk-8-jdk
302302

303-
RUN pip install --no-cache-dir python_lib/controller/python/chip*.whl
303+
RUN pip install --break-system-packages --no-cache-dir python_lib/controller/python/chip*.whl

integrations/docker/images/stage-1/chip-build-crosscompile/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ RUN set -x \
66
&& apt-get update \
77
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \
88
git \
9+
xz-utils \
910
&& apt-get clean \
1011
&& rm -rf /var/lib/apt/lists/ \
1112
&& : # last line

integrations/docker/images/stage-2/chip-build-ameba/Dockerfile

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ ARG VERSION=1
22
FROM ghcr.io/project-chip/chip-build:${VERSION}
33
LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip
44

5+
RUN set -x \
6+
&& apt-get update \
7+
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \
8+
bzip2 \
9+
&& rm -rf /var/lib/apt/lists/ \
10+
&& : # last line
11+
512
# Setup Ameba
613
ARG AMEBA_DIR=/opt/ameba
714
ARG TAG_NAME=ameba_update_2024_03_22

integrations/docker/images/stage-2/chip-build-asr/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ LABEL org.opencontainers.image.source https://github.com/project-chip/connectedh
55
RUN set -x \
66
&& apt-get update \
77
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \
8+
bzip2 \
9+
tar \
810
wget \
911
&& apt-get clean \
1012
&& rm -rf /var/lib/apt/lists/ \

0 commit comments

Comments
 (0)