Skip to content

Commit

Permalink
Add docker files (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinHjelmare authored Dec 23, 2022
1 parent 2e4d9a9 commit 3db18ff
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
50 changes: 50 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM debian:bullseye as base

# Set shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG MATTER_SERVER_VERSION=1.0.7
ARG HOME_ASSISTANT_CHIP_VERSION=2022.11.1

WORKDIR /app

RUN \
set -x \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
libuv1 \
openssl \
zlib1g \
libjson-c5 \
python3-venv \
python3-pip \
python3-gi \
python3-gi-cairo \
python3-dbus \
python3-psutil \
unzip \
libcairo2 \
gdb \
git \
&& git clone --depth 1 -b master \
https://github.com/project-chip/connectedhomeip \
&& cp -r connectedhomeip/credentials /root/credentials \
&& rm -rf connectedhomeip \
&& apt-get purge -y --auto-remove \
git \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /usr/src/*

# hadolint ignore=DL3013
RUN \
pip3 install \
home-assistant-chip-clusters==${HOME_ASSISTANT_CHIP_VERSION} \
home-assistant-chip-core==${HOME_ASSISTANT_CHIP_VERSION} \
&& pip3 install --no-cache-dir python-matter-server=="${MATTER_SERVER_VERSION}"

COPY docker-entrypoint.sh ./

VOLUME ["/data"]
EXPOSE 5580

ENTRYPOINT ["./docker-entrypoint.sh"]
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,18 @@ Please note that development is only possible on Linux and MacOS, no Windows sup
- Download/clone the repo to your local machine.
- Create a Python virtual environment.
- Install the correct SDK wheels for both the cluster and core package, see instructions above if there is no wheel for your setup prebuilt.

## Dockerfile

### Build

```sh
docker-compose build --no-cache matter-server
```

### Run

```sh
docker-compose up -d matter-server
docker-compose logs -f matter-server
```
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: "3.8"
services:
# python-matter-server
matter-server:
build:
context: ./
dockerfile: Dockerfile.dev
image: matter-server:latest
container_name: matter-server
restart: always
security_opt:
# needed for bluetooth via dbus
- apparmor:unconfined
ports:
- "5580:5580"
volumes:
# Create an .env file that sets the USERDIR environment variable.
- ${USERDIR}/docker/matter-server/data:/data/
- /run/dbus:/run/dbus:ro
7 changes: 7 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e

set -- matter-server --storage-path /data "$@"

echo "Starting server:" "$@"
exec "$@"

0 comments on commit 3db18ff

Please sign in to comment.