mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
tools: optimize docker image and fix launchpad builds
- Earlier fixes removed .git which potentially failed building the examples as esp-idf does git describe during builds. Added them back anad build works now. - Removed the dormant bits from the docker-image - Added ninja-jobs option for better resource utilization during host tool builds - Added back the linux installation as we do need ability to run chip-tool from the container.
This commit is contained in:
@@ -10,6 +10,8 @@ ENV DEBIAN_FRONTEND=noninteractive
|
||||
ENV IDF_PATH=/opt/espressif/esp-idf
|
||||
ENV IDF_TOOLS_PATH=/opt/espressif/tools
|
||||
ENV PATH="${IDF_PATH}/tools:${PATH}"
|
||||
# Defaulting to 4 as this would be mostly run on resource constrained machines.
|
||||
ENV NINJA_JOBS=4
|
||||
|
||||
# Install minimal dependencies for ESP-IDF and Matter
|
||||
RUN set -x \
|
||||
@@ -36,7 +38,6 @@ RUN set -x \
|
||||
wget \
|
||||
curl \
|
||||
unzip \
|
||||
rsync \
|
||||
# ESP-IDF requirements
|
||||
flex \
|
||||
bison \
|
||||
@@ -59,9 +60,12 @@ RUN set -x \
|
||||
libmbedtls-dev \
|
||||
# Additional utilities
|
||||
tree \
|
||||
# Cleanup
|
||||
# Cleanup apt and unnecessary files
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rm -rf /usr/share/doc/* /usr/share/man/* /usr/share/info/* \
|
||||
&& rm -rf /usr/share/locale/* \
|
||||
&& rm -rf /var/log/* /var/cache/* \
|
||||
&& git lfs install \
|
||||
&& : # last line
|
||||
|
||||
@@ -69,11 +73,10 @@ 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 \
|
||||
&& ./install.sh --disable-gdbgui --disable-pytest --disable-ci --disable-docs \
|
||||
&& 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 \
|
||||
# remove the archives from the tools path
|
||||
&& rm -rf ${IDF_TOOLS_PATH}/dist \
|
||||
&& rm -rf /root/.cache \
|
||||
&& : # last line
|
||||
|
||||
@@ -90,16 +93,16 @@ RUN set -x \
|
||||
&& git checkout FETCH_HEAD \
|
||||
&& git submodule update --init --depth=1 \
|
||||
&& cd ./connectedhomeip/connectedhomeip \
|
||||
&& ./scripts/checkout_submodules.py --platform esp32 --shallow \
|
||||
&& ./scripts/checkout_submodules.py --platform esp32 linux --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 \
|
||||
&& 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 \
|
||||
&& export IDF_PATH_FORCE=1 && . ${IDF_PATH}/export.sh \
|
||||
&& cd ${ESP_MATTER_PATH} && ./install.sh --ninja-jobs ${NINJA_JOBS} \
|
||||
# Move host tools to /usr/local/bin, strip debug symbols, and remove build directory
|
||||
&& cp ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/out/host/chip-cert /usr/local/bin/ \
|
||||
&& cp ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/out/host/chip-tool /usr/local/bin/ \
|
||||
&& strip /usr/local/bin/chip-cert /usr/local/bin/chip-tool \
|
||||
&& rm -rf ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/out \
|
||||
&& rm -rf /root/.cache /tmp/* \
|
||||
&& : # last line
|
||||
|
||||
@@ -107,4 +110,4 @@ 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