-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docker: Added build arguments and entrypoint
Also documented in a readme
- Loading branch information
1 parent
13468e8
commit 10740a3
Showing
4 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Espressif's SDK for Matter Docker Image | ||
|
||
This is a Docker image for the [Espressif's SDK for Matter (ESP-MATTER)](https://github.com/espressif/esp-matter). It is intended for building applications of ESP-IDF that uses Espressif's SDK for Matter, when doing automated builds. | ||
|
||
This image contains a copy of the Espressif's SDK for Matter, a copy of ESP-IDF and the required tools for Matter to build ESP-IDF projects that use Espressif's SDK for Matter. | ||
|
||
## Basic Usage | ||
|
||
Build a project located in the current directory using `idf.py build` command: | ||
|
||
```bash | ||
docker run --rm -v $PWD:/project -w /project espressif/esp-matter:latest idf.py build | ||
``` | ||
## Building custom images | ||
|
||
The Dockerfile in Espressif's SDK for Matter repository provides several build arguments which can be used to customize the Docker image: | ||
|
||
These are the different build arguments that can be used: | ||
- ``ESP_MATTER_CLONE_URL``: URL of the repository to clone Espressif's SDK for Matter. Can be set to a custom URL when working with a fork of Espressif's SDK for Matter. Default is ``https://github.com/espressif/esp-matter.git``. | ||
- ``ESP_MATTER_CLONE_BRANCH_OR_TAG``: Name of a git branch or tag use when cloning Espressif's SDK for Matter. This value is passed to ``git clone`` command using the ``--branch`` argument. Default is ``main``. | ||
- ``ESP_MATTER_CHECKOUT_REF``: If this argument is set to a non-empty value, ``git checkout $ESP_MATTER_CHECKOUT_REF`` command will be performed after cloning. This argument can be set to the SHA of the specific commit to check out, for example if some specific commit on a release branch is desired. | ||
- ``ESP_MATTER_CLONE_SHALLOW``: If this argument is set to a non-empty value, ``--depth=1`` argument will be used when performing ``git clone`` and it will download only the required submodules by Matter for ESP32 platform only using [``checkout_submodules.py``](https://github.com/project-chip/connectedhomeip/blob/master/scripts/checkout_submodules.py). If it is empty will clone recursively all the submodules from Matter repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
. $IDF_PATH/export.sh | ||
. $ESP_MATTER_PATH/export.sh | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,48 @@ | ||
ARG VERSION=latest | ||
FROM connectedhomeip/chip-build-esp32:${VERSION} as build | ||
|
||
# To build the image for a branch or a tag of ESP-MATTER, pass --build-arg ESP_MATTER_CLONE_BRANCH_OR_TAG=name. | ||
# To build the image with a specific commit ID of ESP-MATTER, pass --build-arg ESP_MATTER_CHECKOUT_REF=commit-id. | ||
# It is possibe to combine both, e.g.: | ||
# ESP_MATTER_CLONE_BRANCH_OR_TAG=release/vX.Y | ||
# ESP_MATTER_CHECKOUT_REF=<some commit on release/vX.Y branch>. | ||
# Use ESP_MATTER_CLONE_SHALLOW=1 to peform shallow clone (i.e. --depth=1 --shallow-submodules) | ||
|
||
ARG ESP_MATTER_CLONE_URL=https://github.com/espressif/esp-matter.git | ||
ARG ESP_MATTER_CLONE_BRANCH_OR_TAG=main | ||
ARG ESP_MATTER_CHECKOUT_REF= | ||
ARG ESP_MATTER_CLONE_SHALLOW= | ||
|
||
WORKDIR /opt/espressif | ||
ENV ESP_MATTER_PATH=/opt/espressif/esp-matter | ||
|
||
RUN set -x \ | ||
&& git clone --depth 1 https://github.com/espressif/esp-matter.git \ | ||
&& cd esp-matter \ | ||
&& git submodule update --init --depth 1 \ | ||
&& ./connectedhomeip/connectedhomeip/scripts/checkout_submodules.py --platform esp32 --shallow \ | ||
&& if [ -n "$ESP_MATTER_CLONE_SHALLOW" ]; then \ | ||
git clone \ | ||
${ESP_MATTER_CLONE_BRANCH_OR_TAG:+-b $ESP_MATTER_CLONE_BRANCH_OR_TAG} \ | ||
$ESP_MATTER_CLONE_URL $ESP_MATTER_PATH; \ | ||
else \ | ||
git clone --recursive \ | ||
${ESP_MATTER_CLONE_BRANCH_OR_TAG:+-b $ESP_MATTER_CLONE_BRANCH_OR_TAG} \ | ||
$ESP_MATTER_CLONE_URL $ESP_MATTER_PATH; \ | ||
fi \ | ||
&& cd $ESP_MATTER_PATH \ | ||
&& if [ -n "$ESP_MATTER_CHECKOUT_REF" ]; then \ | ||
git checkout $ESP_MATTER_CHECKOUT_REF \ | ||
&& if [ -n "$ESP_MATTER_CLONE_SHALLOW" ]; then \ | ||
git fetch origin --depth=1 --recurse-submodules ${ESP_MATTER_CHECKOUT_REF}; \ | ||
fi; \ | ||
fi \ | ||
&& if [ -n "$ESP_MATTER_CLONE_SHALLOW" ]; then \ | ||
git submodule update --init --depth=1 \ | ||
&& ./connectedhomeip/connectedhomeip/scripts/checkout_submodules.py --platform esp32 --shallow; \ | ||
fi \ | ||
&& . $IDF_PATH/export.sh \ | ||
&& ./install.sh \ | ||
&& : # last line | ||
|
||
COPY entrypoint.sh /opt/esp/entrypoint.sh | ||
ENTRYPOINT [ "/opt/esp/entrypoint.sh" ] | ||
CMD [ "/bin/bash" ] | ||
|
||
WORKDIR /opt/espressif/esp-matter |