Skip to content

Commit 45cbf5e

Browse files
committed
Add ESP-Matter development image and update workflows
- Introduce a new Docker image for ESP-Matter v1.4.2, providing a complete environment for developing Matter-compatible devices on ESP32. - Update README files to include ESP-Matter details, usage instructions, and supported chips. - Enhance GitHub Actions workflows to build and push the ESP-Matter image, including multi-platform support and manifest creation. - Add Dockerfile for ESP-Matter, detailing installation of prerequisites and environment setup for development.
1 parent 54e098c commit 45cbf5e

File tree

4 files changed

+506
-4
lines changed

4 files changed

+506
-4
lines changed

.github/workflows/esp-idf.yml

Lines changed: 84 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,87 @@ jobs:
100100
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:idf-${{ matrix.esp_idf_version }}-linux-amd64 \
101101
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:idf-${{ matrix.esp_idf_version }}-linux-arm64
102102
103-
# Future: Add build-esp-matter job here
104-
# It will use: needs: [build-esp-idf]
105-
# and share the same esp_idf_version matrix
103+
build-esp-matter:
104+
runs-on: ubuntu-latest
105+
needs: build-esp-idf
106+
permissions:
107+
contents: read
108+
packages: write
109+
strategy:
110+
matrix:
111+
platform: [linux/amd64, linux/arm64]
112+
esp_idf_version: ['v5.4.1']
113+
esp_matter_version: ['v1.4.2']
114+
steps:
115+
- name: 📥 Checkout repository
116+
uses: actions/checkout@v4
117+
118+
- name: 🔧 Set up Docker Buildx
119+
uses: docker/setup-buildx-action@v3
120+
121+
- name: 🔐 Log in to GitHub Container Registry
122+
if: github.ref_name == 'master'
123+
uses: docker/login-action@v3
124+
with:
125+
registry: ${{ env.REGISTRY }}
126+
username: ${{ github.actor }}
127+
password: ${{ secrets.GITHUB_TOKEN }}
128+
129+
- name: 🏷️ Prepare platform tag
130+
id: platform
131+
run: |
132+
PLATFORM_PAIR=${{ matrix.platform }}
133+
PLATFORM_TAG=$(echo $PLATFORM_PAIR | sed 's/\//-/g')
134+
echo "tag=${PLATFORM_TAG}" >> $GITHUB_OUTPUT
135+
136+
- name: 🐳 Build and push ESP-Matter Docker image
137+
uses: docker/build-push-action@v5
138+
with:
139+
context: images/esp-matter
140+
platforms: ${{ matrix.platform }}
141+
push: ${{ github.ref_name == 'master' }}
142+
tags: |
143+
${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:idf-${{ matrix.esp_idf_version }}-matter-${{ matrix.esp_matter_version }}-${{ steps.platform.outputs.tag }}
144+
cache-from: type=gha,scope=esp-matter-${{ steps.platform.outputs.tag }}
145+
cache-to: type=gha,mode=max,scope=esp-matter-${{ steps.platform.outputs.tag }}
146+
build-args: |
147+
ESP_IDF_VERSION=${{ matrix.esp_idf_version }}
148+
ESP_MATTER_VERSION=${{ matrix.esp_matter_version }}
149+
150+
create-manifest-matter:
151+
runs-on: ubuntu-latest
152+
needs: build-esp-matter
153+
if: github.ref_name == 'master'
154+
permissions:
155+
contents: read
156+
packages: write
157+
strategy:
158+
matrix:
159+
esp_idf_version: ['v5.4.1']
160+
esp_matter_version: ['v1.4.2']
161+
steps:
162+
- name: 🔐 Log in to GitHub Container Registry
163+
uses: docker/login-action@v3
164+
with:
165+
registry: ${{ env.REGISTRY }}
166+
username: ${{ github.actor }}
167+
password: ${{ secrets.GITHUB_TOKEN }}
168+
169+
- name: 🏷️ Generate version and date tags
170+
id: tags
171+
run: |
172+
SHA_SHORT=$(echo "${{ github.sha }}" | cut -c1-7)
173+
DATE_TAG=$(date +%Y.%m.%d)
174+
echo "sha_short=${SHA_SHORT}" >> $GITHUB_OUTPUT
175+
echo "date_tag=${DATE_TAG}" >> $GITHUB_OUTPUT
176+
177+
- name: 🎯 Create multi-arch manifest for ESP-Matter
178+
run: |
179+
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:latest \
180+
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:stable \
181+
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:idf-${{ matrix.esp_idf_version }}-matter-${{ matrix.esp_matter_version }} \
182+
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:matter-${{ matrix.esp_matter_version }} \
183+
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:${{ steps.tags.outputs.date_tag }} \
184+
-t ${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:sha-${{ steps.tags.outputs.sha_short }} \
185+
${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:idf-${{ matrix.esp_idf_version }}-matter-${{ matrix.esp_matter_version }}-linux-amd64 \
186+
${{ env.REGISTRY }}/${{ github.repository_owner }}/jethome-dev-esp-matter:idf-${{ matrix.esp_idf_version }}-matter-${{ matrix.esp_matter_version }}-linux-arm64

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Docker-based development environment for embedded systems, providing containeriz
77
| Image | Description | Documentation |
88
|-------|-------------|---------------|
99
| [esp-idf](./images/esp-idf/) | ESP-IDF 5.4.1 with QEMU, pytest, and testing tools for all ESP32 chips | [README](./images/esp-idf/README.md) |
10+
| [esp-matter](./images/esp-matter/) | ESP-Matter v1.4.2 SDK for Matter protocol development on ESP32 | [README](./images/esp-matter/README.md) |
1011
| [platformio](./images/platformio/) | PlatformIO with ESP32 (all variants) + ESP-IDF + Unity testing | [README](./images/platformio/README.md) |
1112

1213
## Quick Start
@@ -27,6 +28,22 @@ docker run -it --rm -v $(pwd):/workspace \
2728
ghcr.io/jethome-iot/jethome-dev-esp-idf:latest
2829
```
2930

31+
### ESP-Matter
32+
33+
```bash
34+
# Pull image
35+
docker pull ghcr.io/jethome-iot/jethome-dev-esp-matter:latest
36+
37+
# Build Matter project
38+
docker run --rm -v $(pwd):/workspace \
39+
ghcr.io/jethome-iot/jethome-dev-esp-matter:latest \
40+
idf.py build
41+
42+
# Interactive development
43+
docker run -it --rm -v $(pwd):/workspace \
44+
ghcr.io/jethome-iot/jethome-dev-esp-matter:latest
45+
```
46+
3047
### PlatformIO
3148

3249
```bash
@@ -56,6 +73,16 @@ docker run -it --rm -v $(pwd):/workspace \
5673
- **Documentation**: Sphinx, sphinx-rtd-theme
5774
- **Tools**: jq, vim, nano, rsync, git
5875

76+
### ESP-Matter Image
77+
78+
- **Base**: jethome-dev-esp-idf:idf-v5.4.1 (inherits all ESP-IDF tools)
79+
- **ESP-Matter**: v1.4.2 with ConnectedHomeIP SDK
80+
- **Matter Protocol**: Support for Matter 1.0 and 1.1 (partial)
81+
- **Supported Chips**: ESP32-C3, ESP32-C6, ESP32-S3, ESP32-H2 (full Matter support)
82+
- **Features**: Matter device clusters, commissioning, OTA updates
83+
- **Examples**: Light, switch, bridge, temperature sensor, door lock, fan, thermostat
84+
- **Note**: Host tools (chip-tool, chip-cert) not included for minimal image size
85+
5986
### PlatformIO Image
6087

6188
- **Base**: Python 3.11 slim (Debian Bookworm)
@@ -147,12 +174,15 @@ docker build -t jethome-dev-platformio:local .
147174
jethome-dev/
148175
├── .github/
149176
│ └── workflows/ # GitHub Actions workflows
150-
│ ├── esp-idf.yml # ESP-IDF image workflow
177+
│ ├── esp-idf.yml # ESP-IDF and ESP-Matter image workflows
151178
│ └── platformio.yml # PlatformIO image workflow
152179
├── images/
153180
│ ├── esp-idf/ # ESP-IDF 5.4.1 development image
154181
│ │ ├── Dockerfile # Image definition
155182
│ │ └── README.md # Detailed documentation
183+
│ ├── esp-matter/ # ESP-Matter v1.4.2 development image
184+
│ │ ├── Dockerfile # Image definition
185+
│ │ └── README.md # Detailed documentation
156186
│ └── platformio/ # PlatformIO development image
157187
│ ├── Dockerfile # Image definition
158188
│ ├── README.md # Detailed documentation
@@ -168,6 +198,7 @@ jethome-dev/
168198

169199
Images are published to GitHub Container Registry (GHCR):
170200
- **ESP-IDF**: `ghcr.io/jethome-iot/jethome-dev-esp-idf`
201+
- **ESP-Matter**: `ghcr.io/jethome-iot/jethome-dev-esp-matter`
171202
- **PlatformIO**: `ghcr.io/jethome-iot/jethome-dev-platformio`
172203

173204
## Use Cases

images/esp-matter/Dockerfile

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# ESP-Matter Development Image
2+
# Build arguments for version pinning
3+
ARG ESP_IDF_VERSION=v5.4.1
4+
ARG ESP_MATTER_VERSION=v1.4.2
5+
6+
# Use our esp-idf image as base
7+
# For local builds: Uses idf-${ESP_IDF_VERSION} tag
8+
# For CI/CD: Override with --build-arg BASE_IMAGE_TAG=idf-${ESP_IDF_VERSION}-linux-${ARCH}
9+
ARG BASE_IMAGE_TAG=idf-${ESP_IDF_VERSION}
10+
FROM ghcr.io/jethome-iot/jethome-dev-esp-idf:${BASE_IMAGE_TAG}
11+
12+
# Re-declare build arguments after FROM
13+
ARG ESP_MATTER_VERSION
14+
15+
# Install Matter prerequisites
16+
# Based on https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html
17+
RUN apt-get update && apt-get install -y \
18+
# Build essentials
19+
pkg-config \
20+
ninja-build \
21+
# Python development
22+
python3-venv \
23+
python3-pip \
24+
# Matter SDK dependencies
25+
libssl-dev \
26+
libdbus-1-dev \
27+
libglib2.0-dev \
28+
libavahi-client-dev \
29+
# Clean up
30+
&& apt-get clean \
31+
&& rm -rf /var/lib/apt/lists/*
32+
33+
# Clone esp-matter repository
34+
# Using shallow clone to reduce image size
35+
# ESP-Matter uses release branches (e.g., release/v1.4.2)
36+
WORKDIR /opt
37+
RUN git clone --depth 1 --branch release/${ESP_MATTER_VERSION} \
38+
https://github.com/espressif/esp-matter.git && \
39+
cd esp-matter && \
40+
git submodule update --init --depth 1
41+
42+
# Checkout connectedhomeip submodules
43+
# Include both linux and darwin platforms for maximum compatibility
44+
WORKDIR /opt/esp-matter/connectedhomeip/connectedhomeip
45+
RUN ./scripts/checkout_submodules.py --platform esp32 linux darwin --shallow
46+
47+
# Install esp-matter (without host tools)
48+
# Host tools (chip-tool, chip-cert, etc.) are excluded to reduce image size
49+
# Use --break-system-packages since this is a containerized environment
50+
WORKDIR /opt/esp-matter
51+
RUN PIP_BREAK_SYSTEM_PACKAGES=1 ./install.sh --no-host-tool
52+
53+
# Set ESP-Matter environment variables
54+
ENV ESP_MATTER_PATH=/opt/esp-matter
55+
56+
# Create entrypoint script that activates both ESP-IDF and ESP-Matter environments
57+
RUN printf '#!/bin/bash\n\
58+
set -e\n\
59+
\n\
60+
# Source ESP-IDF environment (from base image)\n\
61+
if [ -f "${IDF_PATH}/export.sh" ]; then\n\
62+
. "${IDF_PATH}/export.sh" > /dev/null 2>&1\n\
63+
fi\n\
64+
\n\
65+
# Source ESP-Matter environment\n\
66+
if [ -f "${ESP_MATTER_PATH}/export.sh" ]; then\n\
67+
. "${ESP_MATTER_PATH}/export.sh" > /dev/null 2>&1\n\
68+
fi\n\
69+
\n\
70+
# Execute the command\n\
71+
exec "$@"\n\
72+
' > /opt/esp-matter/entrypoint.sh && \
73+
chmod +x /opt/esp-matter/entrypoint.sh
74+
75+
# Set working directory back to workspace
76+
WORKDIR /workspace
77+
78+
# Verify installation
79+
RUN bash -c '. ${IDF_PATH}/export.sh && \
80+
. ${ESP_MATTER_PATH}/export.sh && \
81+
python --version && \
82+
idf.py --version && \
83+
echo "ESP-Matter ${ESP_MATTER_VERSION} installation verified successfully"'
84+
85+
# Use custom entrypoint to activate environments
86+
ENTRYPOINT ["/opt/esp-matter/entrypoint.sh"]
87+
88+
CMD ["/bin/bash"]
89+

0 commit comments

Comments
 (0)