Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#SERIAL_PORT = /dev/ttyUSB0
NODE_IP = 192.168.253.162
#NODE_BLE =
LAT = 47.73322
LON = 12.11043
RAD = 30
# MC_HEADLESS = true
# MC_GUIONLY = true
#MC_MAPTILER_KEY =
51 changes: 51 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Docker Build and Push

on:
push:
branches: [ "main", "master" ]
tags: [ 'v*.*.*' ]
workflow_dispatch:

env:
REGISTRY: ghcr.io
# IMAGE_NAME musi być małymi literami. github.repository może zawierać wielkie litery.
# Dlatego w kroku budowania użyjemy metadanych, które to wyczyszczą.
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Akcja automatycznie zamienia nazwy obrazów na małe litery.
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=semver,pattern={{version}}
type=sha,format=short

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM python:3.11-slim

WORKDIR /app

# Deps
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
python3-dev \
&& rm -rf /var/lib/apt/lists/*

COPY requirements.txt* ./
RUN if [ -f requirements.txt ]; then pip install --no-cache-dir -r requirements.txt; fi

COPY . .

# Perms
RUN chmod +x entrypoint.sh

# Entrypoint
ENTRYPOINT ["./entrypoint.sh"]
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ This will:

Stop the tool with `Ctrl+C`.

## Docker

You can use Meshcore Reachability as a Docker container.

Compose file is available in this repository. You can use it in Portainer Stack or directly using

```bash
docker compose up -d
```

Remember to set your env vars!

### Command line options

From `--help` in `meshcore_reachability.py`:
Expand Down
20 changes: 20 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
services:
reachability:
image: ghcr.io/usrflo/meshcore-reachability:latest
container_name: meshcore-reachability
restart: unless-stopped
# If using serial:
# devices:
# - "/dev/ttyUSB0:/dev/ttyUSB0"
ports:
- "5342:5342"
environment:
#- SERIAL_PORT=/dev/ttyUSB0
- NODE_IP=192.168.253.162
- LAT=51.1234 # Twoja szeroko..
- LON=20.2233 # Twoja d.ugo..
- RAD=25 # Promie. w km
- MC_HEADLESS=false # Ustaw na true, je.li nie chcesz UI
#- MC_MAPTILER_KEY=your_api_key
volumes:
- /opt/meshcore-reachability:/app/data # Persist data
17 changes: 17 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# entrypoint.sh

ARGS=""

if [ -n "$SERIAL_PORT" ]; then ARGS="$ARGS -p $SERIAL_PORT"; fi
if [ -n "$NODE_IP" ]; then ARGS="$ARGS -ip $NODE_IP"; fi
if [ -n "$NODE_BLE" ]; then ARGS="$ARGS --ble $NODE_BLE"; fi
if [ -n "$LAT" ]; then ARGS="$ARGS -lat $LAT"; fi
if [ -n "$LON" ]; then ARGS="$ARGS -lon $LON"; fi
if [ -n "$RAD" ]; then ARGS="$ARGS -rad $RAD"; fi
if [ "$MC_HEADLESS" = "true" ]; then ARGS="$ARGS --headless"; fi
if [ "$MC_GUIONLY" = "true" ]; then ARGS="$ARGS --guionly"; fi
if [ -n "$MC_MAPTILER_KEY" ]; then ARGS="$ARGS -ak $MC_MAPTILER_KEY"; fi

# Uruchomienie aplikacji z przekazanymi argumentami
exec python meshcore_reachability.py $ARGS