Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dockerfiles to ubuntu:24.04 #33637

Merged
merged 44 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3298614
Update to ubuntu 24.04 and bump version
andreilitvin May 28, 2024
52e47e7
Fix comment
andreilitvin May 28, 2024
b36ae55
Dependencies update
andreilitvin May 28, 2024
a21c73c
Use the latest gcc by default
andreilitvin May 28, 2024
a533b89
Fix up clang save & cleanup
andreilitvin May 28, 2024
73dc825
More build fixes
andreilitvin May 28, 2024
ee7910c
Add more --break-system-packages
andreilitvin May 28, 2024
851353f
Do not remove libllvm17t64 ... I am unsure about that one
andreilitvin May 28, 2024
39dd17e
Remove it after all ... seems some size savings here
andreilitvin May 28, 2024
0127c6a
More cleanup
andreilitvin May 28, 2024
80d2b8a
Drop alternative install
andreilitvin May 28, 2024
9ea09a6
Install gcc without a specific version. Undoes #28478
andreilitvin May 28, 2024
87ea25b
Need llvm18-dev as well
andreilitvin May 28, 2024
0dc6251
Update to lib64 paths
andreilitvin May 28, 2024
f14b85c
Also install xz
andreilitvin May 28, 2024
fcf3a20
xz is in utils
andreilitvin May 28, 2024
ecff592
Fix asr depends when no recommends is installed
andreilitvin May 28, 2024
7346363
Clean up infineon, make the curl download to NOT be silent
andreilitvin May 28, 2024
75bfebd
using -j8 is arbitrary ... use nproc instead
andreilitvin May 28, 2024
436b456
update what qemu means
andreilitvin May 28, 2024
1123daa
Install patch for the qemu image build
andreilitvin May 30, 2024
c0f4cd2
Adapt Tizen Dockerfiles
mbknust Jun 3, 2024
980377b
Merge pull request #205 from mbknust/update_to_ubuntu_24_04
andy31415 Jun 3, 2024
fb18e9b
Update ubuntu version
jlatusek Jun 6, 2024
745ed8c
Update Dockerfile for chip-build-linux-qemu image
jlatusek Jun 6, 2024
0487a94
Merge pull request #206 from jlatusek/qemu-ubuntu-24-04
andy31415 Jun 6, 2024
eac1a54
Merge branch 'master' into update_to_ubuntu_24_04
andreilitvin Jun 13, 2024
777791f
Restyle
andreilitvin Jun 13, 2024
dfe83e4
Add ability to skip already built things, otherwise docker keeps re-b…
andreilitvin Jun 14, 2024
6be0a0c
Docker image inspect is MUCH faster than docker images
andreilitvin Jun 14, 2024
745b7f7
Fix nrf build
andreilitvin Jun 14, 2024
c2a07c0
Fix ameba dockerfile build
andreilitvin Jun 14, 2024
b35b5ce
Fix cirque image build
andreilitvin Jun 14, 2024
a06ec35
Make imx image work
andreilitvin Jun 14, 2024
3f443e0
Make build ordering predictable
andreilitvin Jun 14, 2024
fc54992
Fix k32w image build
andreilitvin Jun 14, 2024
db32179
Fix telink image build
andreilitvin Jun 14, 2024
a7558e4
Speed up android image build by a lot
andreilitvin Jun 14, 2024
26ed230
Bump up espressif qemu build, do not use the 3-year old version
andreilitvin Jun 14, 2024
40d81df
Update versions to match system package versions, so that bootstrap i…
andreilitvin Jun 14, 2024
defd85e
Make sure that patch is available in the base image, we seem to use i…
andreilitvin Jun 14, 2024
6593add
One documentation update
andreilitvin Jun 14, 2024
7151dc5
Also allow compilation of mbedos bits in the vscode image
andreilitvin Jun 14, 2024
bee5cda
Include what you use from system
andreilitvin Jun 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions integrations/docker/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,33 @@ set -e

SUB_PATH="*"
ALL_ARGS=""
SKIP_BUILT=0

for i in "$@"; do
case $i in
-h | --help)
echo "Supported arguments:"
echo " -h/--help This help text"
echo " -p/--path sub-path in integrations/docker/images to build (defaults to * for everything)"
echo " -skip-built Do not rebuild images already found as built"
exit 0
;;
-p=* | --path=*)
SUB_PATH="${i#*=}"
;;
--skip-built)
SKIP_BUILT=1
;;
*)
ALL_ARGS="$ALL_ARGS ${i#*=}"
;;
esac
done

VERSION=${DOCKER_BUILD_VERSION:-$(sed 's/ .*//' "$(git rev-parse --show-toplevel)"/integrations/docker/images/base/chip-build/version)}

echo "SUB_PATH: $SUB_PATH"
echo "VERSION: $VERSION"

function build_image() {
PARSE_PATH=$1
Expand All @@ -46,8 +60,17 @@ function build_image() {
echo "PARSE_PATH: $PARSE_PATH"
echo "ARGS_TO_PASS: $ARGS_TO_PASS"

find "$(git rev-parse --show-toplevel)"/integrations/docker/images/$PARSE_PATH -name Dockerfile ! -path "*chip-cert-bins/*" | while read -r dockerfile; do
echo "$(dirname "$dockerfile")"
find "$(git rev-parse --show-toplevel)"/integrations/docker/images/$PARSE_PATH -name Dockerfile ! -path "*chip-cert-bins/*" | sort | while read -r dockerfile; do
# Images are of the form `ghcr.io/project-chip/{name}` and tagged as "${VERSION}"
DOCKER_PATH=$(dirname $dockerfile) # Drop the file name
IMAGE_NAME="ghcr.io/project-chip/${DOCKER_PATH##*/}:${VERSION}" # Drop directory prefix

if [ $SKIP_BUILT -ne 0 ] && docker image inspect "${IMAGE_NAME}" >/dev/null 2>&1; then
echo "Image ${IMAGE_NAME} already exists. Skipping build"
continue
fi

echo "BUILDING $(dirname "$dockerfile") (i.e. ${IMAGE_NAME})"
pushd "$(dirname "$dockerfile")" >/dev/null
./build.sh "$ARGS_TO_PASS"
popd >/dev/null
Expand Down
22 changes: 7 additions & 15 deletions integrations/docker/images/base/chip-build-minimal/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
# This minimal build image is intentionally not based on chip-build
FROM ubuntu:focal
FROM ubuntu:24.04
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip

# ARG NINJA_VERSION=v1.11.1
ARG GN_HASH=5a004f9427a050c6c393c07ddb85cba8ff3849fa

RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential ca-certificates git pkg-config python3-venv ninja-build \
build-essential \
ca-certificates \
generate-ninja \
git pkg-config \
ninja-build \
python3-venv \
&& git config --global advice.detachedHead false

# RUN set -x && cd /var/tmp \
# && git clone --branch "$NINJA_VERSION" https://github.com/ninja-build/ninja.git \
# && ( cd ninja && ./configure.py --bootstrap && install -m 0755 ninja /usr/local/bin/ ) \
# && rm -rf ninja

RUN set -x && cd /var/tmp \
&& git clone https://gn.googlesource.com/gn \
&& ( cd gn && git checkout "$GN_HASH" && CXX=g++ build/gen.py && ninja -C out && install -m 0755 out/gn /usr/local/bin/ ) \
&& rm -rf gn

# CHIP build dependencies
RUN set -x \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
Expand Down
155 changes: 26 additions & 129 deletions integrations/docker/images/base/chip-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# start with Ubuntu 20.04LTS
FROM ubuntu:focal
FROM ubuntu:24.04
LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip

VOLUME "/var/source"
Expand Down Expand Up @@ -30,7 +29,7 @@ RUN case ${TARGETPLATFORM} in \
# base build and check tools and libraries layer
RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --fix-missing \
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --fix-missing --no-install-recommends \
autoconf \
automake \
bison \
Expand All @@ -39,23 +38,27 @@ RUN set -x \
clang \
clang-format \
clang-tidy \
cmake \
curl \
flex \
g++-10 \
g++ \
generate-ninja \
git \
git-lfs \
gperf \
iproute2 \
iwyu \
jq \
lcov \
libavahi-client-dev \
libavahi-common-dev \
libcairo-dev \
libcairo2-dev \
libcairo-dev \
libdbus-1-dev \
libdbus-glib-1-dev \
libdmalloc-dev \
libgif-dev \
libgirepository-1.0-1 \
libglib2.0-dev \
libical-dev \
libjpeg-dev \
Expand All @@ -68,8 +71,8 @@ RUN set -x \
libpango1.0-dev \
libpixman-1-dev \
libreadline-dev \
libsdl-pango-dev \
libsdl2-dev \
libsdl-pango-dev \
libssl-dev \
libtool \
libudev-dev \
Expand All @@ -80,11 +83,19 @@ RUN set -x \
meson \
net-tools \
ninja-build \
nodejs \
patch \
pkg-config \
python3 \
python3-click \
python3-coloredlogs \
python3-dev \
python3-future \
python3-pandas \
python3-pip \
python3-tabulate \
python3-venv \
python-is-python3 \
python3.9 \
python3.9-dev \
python3.9-venv \
rsync \
shellcheck \
strace \
Expand All @@ -97,73 +108,19 @@ RUN set -x \
&& git lfs install \
&& : # last line

# Set gcc 10 as a default compiler to work with TSAN
RUN set -x \
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 \
&& update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 \
&& update-alternatives --set cc /usr/bin/gcc \
&& update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 \
&& update-alternatives --set c++ /usr/bin/g++ \
&& : # last line

# Cmake v3.23.1
ENV CMAKE_PLATFORM_VERSION=
RUN case ${TARGETPLATFORM} in \
"linux/amd64") CMAKE_PLATFORM_VERSION="x86_64";; \
"linux/arm64") CMAKE_PLATFORM_VERSION="aarch64";; \
*) \
test -n "$TARGETPLATFORM" \
echo "Unsupported platform ${TARGETPLATFORM}" \
&& return 1 ;\
;; \
esac \
&& set -x \
&& (cd /tmp \
&& wget --progress=dot:giga https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-Linux-$CMAKE_PLATFORM_VERSION.sh \
&& sh cmake-3.23.1-Linux-$CMAKE_PLATFORM_VERSION.sh --exclude-subdir --prefix=/usr/local \
&& rm -rf cmake-3.23.1-Linux-$CMAKE_PLATFORM_VERSION.sh) \
&& exec bash \
&& : # last line

# Python 3.9 and PIP
RUN set -x \
&& DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y libgirepository1.0-dev \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common \
&& add-apt-repository universe \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
&& python3.9 get-pip.py \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 \
&& rm -rf /var/lib/apt/lists/ \
&& : # last line

# NOTE: this install is NOT ideal as we are installing over system
# we should migrate to venvs for packages we do not directly have
# provided by the system
RUN set -x \
&& pip3 install --no-cache-dir \
&& pip3 install --break-system-packages --no-cache-dir --break-system-packages \
attrs \
click \
coloredlogs \
cxxfilt \
future \
ghapi \
mobly \
pandas \
portpicker \
pygit \
PyGithub \
ruff \
tabulate \
&& : # last line

# build and install gn
RUN set -x \
&& git clone https://gn.googlesource.com/gn \
&& cd gn \
&& python3 build/gen.py \
&& ninja -C out \
&& cp out/gn /usr/local/bin \
&& cd .. \
&& rm -rf gn \
&& : # last line

# Install bloat comparison tools
Expand All @@ -172,38 +129,13 @@ RUN set -x \
&& mkdir -p bloaty/build \
&& cd bloaty/build \
&& cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../ \
&& make -j8 \
&& make -j$(nproc) \
&& strip bloaty \
&& make install \
&& cd ../.. \
&& rm -rf bloaty \
&& : # last line

# Need newer version of include-what-you-use
RUN set -x \
&& apt-get update \
# Install build and runtime requirements for IWYU
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --fix-missing clang-12 libclang-12-dev \
# Build and install IWYU
arkq marked this conversation as resolved.
Show resolved Hide resolved
&& 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_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 \
# Cleanup build dependencies
&& apt autopurge -fy clang-12 libclang-12-dev \
&& rm -rf /var/lib/apt/lists/ \
# Restore clang-12 files
&& tar -xf clang-12-files.tar -C / \
# Cleanup
&& cd ../.. \
&& rm -rf include-what-you-use \
&& : # last line

# Build glib-2.0 from source with enabled thread sanitizer. This is needed for
# running CHIP tests with TSAN enabled. When running applications with TSAN
# all shared libraries should be built with TSAN enabled, otherwise TSAN might
Expand All @@ -219,7 +151,7 @@ RUN case ${TARGETPLATFORM} in \
&& git clone --depth=1 --branch=$GLIB_VERSION https://github.com/GNOME/glib.git \
&& CFLAGS="-O2 -g -fsanitize=thread" meson glib/build glib -Dtests=false \
&& DESTDIR=../build-image ninja -C glib/build install \
&& mv glib/build-image/usr/local/lib/x86_64-linux-gnu/lib* $LD_LIBRARY_PATH_TSAN \
&& mv glib/build-image/usr/local/lib64/lib* $LD_LIBRARY_PATH_TSAN \
&& rm -rf glib \
;; \
"linux/arm64") \
Expand All @@ -231,41 +163,6 @@ RUN case ${TARGETPLATFORM} in \
;; \
esac

# NodeJS: install a newer version than what apt-get would read
# This installs the latest LTS version of nodejs
#
# NodeJS is required by github actions, we use Wandalen/wretry.action@v1.3.0
# and that seems to use the built-in node installation in the image
#
# This is not a CHIP dependency directly, but used by CI
ENV CHIP_NODE_VERSION=v16.13.2
ENV NODE_PLATFORM_VERSION=
RUN case ${TARGETPLATFORM} in \
"linux/amd64") NODE_PLATFORM_VERSION=x64;; \
"linux/arm64") NODE_PLATFORM_VERSION=arm64;; \
*) \
test -n "$TARGETPLATFORM" \
echo "Unsupported platform ${TARGETPLATFORM}" \
&& return 1 ;\
;; \
esac \
&& set -x \
&& mkdir node_js \
&& cd node_js \
&& wget https://nodejs.org/dist/$CHIP_NODE_VERSION/node-$CHIP_NODE_VERSION-linux-$NODE_PLATFORM_VERSION.tar.xz \
&& tar xfvJ node-$CHIP_NODE_VERSION-linux-$NODE_PLATFORM_VERSION.tar.xz \
&& mv node-$CHIP_NODE_VERSION-linux-$NODE_PLATFORM_VERSION /opt/ \
&& ln -s /opt/node-$CHIP_NODE_VERSION-linux-$NODE_PLATFORM_VERSION /opt/node \
&& ln -s /opt/node/bin/* /usr/bin \
&& 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 @@
54 : [Telink] Update Docker image (Zephyr update)
55 : Update to Ubuntu 24.04 as the base build image
8 changes: 4 additions & 4 deletions integrations/docker/images/chip-cert-bins/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Stage 1: Setup dependencies (based on chip-build).
FROM ubuntu:22.04 as chip-build-cert
FROM ubuntu:24.04 as chip-build-cert
LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip
ARG TARGETPLATFORM
# COMMITHASH defines the target commit to build from. May be passed in using --build-arg.
Expand Down Expand Up @@ -292,12 +292,12 @@ COPY --from=chip-build-cert-bins /root/connectedhomeip/out/python_env python_env
COPY --from=chip-build-cert-bins /root/connectedhomeip/src/python_testing python_testing

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

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

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

RUN pip install --no-cache-dir python_lib/controller/python/chip*.whl
RUN pip install --break-system-packages --no-cache-dir python_lib/controller/python/chip*.whl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \
git \
xz-utils \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
&& : # last line
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ ARG VERSION=1
FROM ghcr.io/project-chip/chip-build:${VERSION}
LABEL org.opencontainers.image.source https://github.com/project-chip/connectedhomeip

RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \
bzip2 \
&& rm -rf /var/lib/apt/lists/ \
&& : # last line

# Setup Ameba
ARG AMEBA_DIR=/opt/ameba
ARG TAG_NAME=ameba_update_2024_03_22
Expand Down
2 changes: 2 additions & 0 deletions integrations/docker/images/stage-2/chip-build-asr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ LABEL org.opencontainers.image.source https://github.com/project-chip/connectedh
RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \
bzip2 \
tar \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
Expand Down
Loading
Loading