From 091ffea1a5bcfddc09ee676a9852ef4a960cd6dd Mon Sep 17 00:00:00 2001 From: luk-ada <45640151+luk-ada@users.noreply.github.com> Date: Sun, 12 Apr 2026 18:50:08 +0200 Subject: [PATCH] docker support --- .gitignore | 2 ++ Dockerfile | 13 +++++++++++++ README.md | 26 ++++++++++++++++++++++++++ docker-compose.yml | 18 ++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f528a47 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.github/ +docker-build.sh \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..495a84e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM python:3-alpine + +RUN apk --no-cache upgrade + +WORKDIR /app + +RUN pip install --no-cache-dir meshcore + +COPY meshcore_multitcp_packets.py meshcore_multitcp.py ./ + +RUN mkdir /data + +ENTRYPOINT ["python3", "meshcore_multitcp.py"] diff --git a/README.md b/README.md index bc9e539..8d89b30 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ multiplexing a mescore tcp-connected companion to multiple clients as cli-chat, - python3 - python meshcore package (pip install meshcore) +alternatively: docker + ## usage python3 meshcore_multitcp.py -d Device-IP:PORT -s Server-IP:PORT [-q|-v] @@ -32,6 +34,30 @@ python3 meshcore_multitcp.py -d Device-IP:PORT -s Server-IP:PORT [-q|-v] After meshcore_multitcp is running you can connect your clients to IP/port set with -s +## docker + +```bash +# build +docker build -t meshcore-multitcp . + +# run +docker run -p 5000:5000 meshcore-multitcp -d Device-IP:PORT -s 0.0.0.0:5000 [-q|-v] +``` + +### docker compose + +Copy and edit `docker-compose.yml` to match your setup: + +- `-d` - IP and port of your companion radio +- `-s 0.0.0.0:PORT` - port the proxy listens on for clients (always use `0.0.0.0` inside the container) +- `-f 0.0.0.0:PORT` - port for store & forward clients (requires `-sql`) +- `ports` - use `host-ip:port:port` to bind to a specific host interface, or `port:port` for all interfaces +- `volumes` - mount a host path to `/data` to persist the SQLite database across restarts + +```bash +docker compose up -d +``` + ## S&F - store & forward messages Using option -sql meshcore-multitcp will store all incomming private & channel messages in local sqlite3-database. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c07655e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +services: + meshcore-multitcp: + image: ghcr.io/luk-ada/meshcore_multitcp:latest + pull_refresh_after: 12h + # -d meshcore device IP and port + # -s/-f use 0.0.0.0 and specific port to listen for server connections + # -sql enable SQL database for device info and stats + command: > + -d 192.168.0.21:5000 + -s 0.0.0.0:5010 + -f 0.0.0.0:5011 + -sql + ports: + - "10.100.100.10:5010:5010" # for multi IP support, bind to specific IP + - "5011:5011" # bind to all interfaces for forwarding + volumes: + - ./data:/data + restart: unless-stopped