mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 11:03:05 +00:00
launchpad: unroll the chip-build image to reduce image size
esp-matter docker image size is increased a lot, chip-build image contains a lot more bloaty things that we do not need. So, falling back to ubuntu base image.
This commit is contained in:
@@ -59,7 +59,6 @@ jobs:
|
||||
- {example: door_lock, target: esp32c2, prefix: wifi_matter}
|
||||
- {example: door_lock, target: esp32h2, prefix: thread_matter}
|
||||
|
||||
|
||||
steps:
|
||||
- run: mkdir -p images
|
||||
- name: build application
|
||||
@@ -82,10 +81,10 @@ jobs:
|
||||
OUT_BIN="$GITHUB_WORKSPACE/images/$TARGET_CHIP"_${{ matrix.targets.prefix }}_"$APP_BIN"
|
||||
esptool.py --chip $TARGET_CHIP merge_bin -o $OUT_BIN `cat flash_args | tr '\n' '\ '`
|
||||
|
||||
# record the esp-idf and esp-matter commit
|
||||
idf_rev=`git -C $IDF_PATH rev-parse --short HEAD`
|
||||
mtr_rev=`git -C $ESP_MATTER_PATH rev-parse --short HEAD`
|
||||
chip_rev=`git -C $ESP_MATTER_PATH/connectedhomeip/connectedhomeip rev-parse --short HEAD`
|
||||
# read commit ids from pre-stored files
|
||||
idf_rev=`cat /opt/espressif/esp-idf-commit.txt`
|
||||
mtr_rev=`cat /opt/espressif/esp-matter-commit.txt`
|
||||
chip_rev=`cat /opt/espressif/connectedhomeip-commit.txt`
|
||||
echo "- esp-idf: [$idf_rev](https://github.com/espressif/esp-idf/tree/$idf_rev)" >> $GITHUB_WORKSPACE/images/.esp-idf
|
||||
echo "- esp-matter: [$mtr_rev](https://github.com/espressif/esp-matter/tree/$mtr_rev)" >> $GITHUB_WORKSPACE/images/.esp-matter
|
||||
echo "- connectedhomeip: [$chip_rev](https://github.com/project-chip/connectedhomeip/tree/$chip_rev)" >> $GITHUB_WORKSPACE/images/.chip
|
||||
|
||||
@@ -1,40 +1,84 @@
|
||||
# 67 is the latest tag which updates the docker image for ESP32 platform
|
||||
# hence pinning version to 67 for building with v1.4-branch.
|
||||
ARG VERSION=67
|
||||
FROM ghcr.io/project-chip/chip-build:${VERSION} as build
|
||||
|
||||
# Use IDF_CHECKOUT_REF to specify a tag, a branch or a specific commit ID.
|
||||
# Minimal Ubuntu-based image for ESP32 Matter builds
|
||||
FROM ubuntu:24.04
|
||||
|
||||
# Build arguments
|
||||
ARG IDF_CLONE_URL=https://github.com/espressif/esp-idf.git
|
||||
ARG IDF_CHECKOUT_REF=v5.1
|
||||
|
||||
# Environment variables
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV IDF_PATH=/opt/espressif/esp-idf
|
||||
ENV IDF_TOOLS_PATH=/opt/espressif/tools
|
||||
ENV PATH="${IDF_PATH}/tools:${PATH}"
|
||||
|
||||
# Install minimal dependencies for ESP-IDF and Matter
|
||||
RUN set -x \
|
||||
&& mkdir -p /tmp/esp-idf \
|
||||
&& cd /tmp/esp-idf \
|
||||
&& git init \
|
||||
&& git remote add origin $IDF_CLONE_URL \
|
||||
&& git fetch origin --depth=1 --recurse-submodules ${IDF_CHECKOUT_REF} \
|
||||
&& git checkout FETCH_HEAD \
|
||||
&& git submodule update --init --recursive --depth 1 \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
# Build essentials (gcc, g++, make, etc.)
|
||||
build-essential \
|
||||
cmake \
|
||||
ninja-build \
|
||||
ccache \
|
||||
# Autotools (required by Matter bootstrap)
|
||||
autoconf \
|
||||
automake \
|
||||
libtool \
|
||||
# Python (ESP-IDF + Matter requirements)
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
python3-dev \
|
||||
python-is-python3 \
|
||||
# Version control and tools
|
||||
git \
|
||||
git-lfs \
|
||||
wget \
|
||||
curl \
|
||||
unzip \
|
||||
rsync \
|
||||
# ESP-IDF requirements
|
||||
flex \
|
||||
bison \
|
||||
gperf \
|
||||
libncurses5-dev \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
libusb-1.0-0 \
|
||||
dfu-util \
|
||||
# Matter/CHIP core requirements
|
||||
nodejs \
|
||||
pkg-config \
|
||||
libglib2.0-dev \
|
||||
libdbus-1-dev \
|
||||
libavahi-client-dev \
|
||||
libavahi-common-dev \
|
||||
libgirepository1.0-dev \
|
||||
libcairo2-dev \
|
||||
libreadline-dev \
|
||||
libmbedtls-dev \
|
||||
# Additional utilities
|
||||
tree \
|
||||
# Cleanup
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& git lfs install \
|
||||
&& : # last line
|
||||
|
||||
FROM ghcr.io/project-chip/chip-build:${VERSION}
|
||||
|
||||
ENV IDF_PATH=/opt/espressif/esp-idf/
|
||||
ENV IDF_TOOLS_PATH=/opt/espressif/tools
|
||||
|
||||
COPY --from=build /tmp/esp-idf /opt/espressif/esp-idf
|
||||
|
||||
# Setup the ESP-IDF
|
||||
WORKDIR /opt/espressif/esp-idf
|
||||
WORKDIR /opt/espressif
|
||||
RUN set -x \
|
||||
&& git clone --depth=1 --branch=${IDF_CHECKOUT_REF} --recurse-submodules --shallow-submodules ${IDF_CLONE_URL} ${IDF_PATH} \
|
||||
&& cd ${IDF_PATH} \
|
||||
&& ./install.sh \
|
||||
&& git rev-parse --short HEAD > /opt/espressif/esp-idf-commit.txt \
|
||||
&& rm -rf .git \
|
||||
&& find . -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true \
|
||||
&& find . -name "*.pyc" -delete 2>/dev/null || true \
|
||||
&& rm -rf /root/.cache \
|
||||
&& : # last line
|
||||
|
||||
ARG ESP_MATTER_CLONE_URL=https://github.com/espressif/esp-matter.git
|
||||
ARG ESP_MATTER_CHECKOUT_REF=main
|
||||
|
||||
WORKDIR /opt/espressif
|
||||
ENV ESP_MATTER_PATH=/opt/espressif/esp-matter
|
||||
|
||||
RUN set -x \
|
||||
@@ -44,26 +88,23 @@ RUN set -x \
|
||||
&& git remote add origin $ESP_MATTER_CLONE_URL \
|
||||
&& git fetch origin --depth=1 ${ESP_MATTER_CHECKOUT_REF} \
|
||||
&& git checkout FETCH_HEAD \
|
||||
&& git submodule update --init --depth 1 \
|
||||
&& git submodule update --init --depth=1 \
|
||||
&& cd ./connectedhomeip/connectedhomeip \
|
||||
&& ./scripts/checkout_submodules.py --platform esp32 linux --shallow \
|
||||
&& cd ../.. \
|
||||
&& cd $IDF_PATH \
|
||||
&& . ./export.sh \
|
||||
&& cd $ESP_MATTER_PATH \
|
||||
&& ./scripts/checkout_submodules.py --platform esp32 --shallow \
|
||||
&& git rev-parse --short HEAD > /opt/espressif/connectedhomeip-commit.txt \
|
||||
&& cd ${ESP_MATTER_PATH} && git rev-parse --short HEAD > /opt/espressif/esp-matter-commit.txt \
|
||||
&& . ${IDF_PATH}/export.sh \
|
||||
&& ./install.sh \
|
||||
&& : # last line
|
||||
|
||||
RUN set -x \
|
||||
&& apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \
|
||||
tree \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/ \
|
||||
&& rm -rf ${ESP_MATTER_PATH}/.git \
|
||||
&& rm -rf ${ESP_MATTER_PATH}/.gitmodules \
|
||||
&& find ${ESP_MATTER_PATH} -name ".git" -exec rm -rf {} + 2>/dev/null || true \
|
||||
&& find ${ESP_MATTER_PATH} -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true \
|
||||
&& find ${ESP_MATTER_PATH} -name "*.pyc" -delete 2>/dev/null || true \
|
||||
&& rm -rf /root/.cache /tmp/* \
|
||||
&& : # last line
|
||||
|
||||
COPY entrypoint.sh /opt/esp/entrypoint.sh
|
||||
ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
|
||||
CMD [ "/bin/bash" ]
|
||||
|
||||
WORKDIR /opt/espressif/esp-matter
|
||||
WORKDIR /opt/espressif/esp-matter
|
||||
Reference in New Issue
Block a user