From bb15ed903defcfd175ab5372f1b51db1f86c16d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Kelemen?= <10376327+prampec@users.noreply.github.com> Date: Tue, 22 Feb 2022 13:18:54 +0100 Subject: [PATCH] Cleanup docker readme. (#1233) Cleanup docker readme. --- README-docker.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ docker.txt | 17 ------------ 2 files changed, 72 insertions(+), 17 deletions(-) create mode 100644 README-docker.md delete mode 100644 docker.txt diff --git a/README-docker.md b/README-docker.md new file mode 100644 index 000000000..8c7b8eab5 --- /dev/null +++ b/README-docker.md @@ -0,0 +1,72 @@ +## What is Docker used for + +Developers can simulate Device hardware by compiling and running +a linux native binary application. If you do not own a Linux +machine, or you just want to separate things, you might want +to run simulator inside a docker container + +## The Image +To build docker image, type + + `docker build -t meshtastic/device .` + +## Usage + +To run a container, type + + `docker run --rm -p 4403:4403 meshtastic/device` + +or, to get an interactive shell on the docker created container: + + `docker run -it -p 4403:4403 meshtastic/device bash` + +You might want to mount your local development folder: + + `docker run -it --mount type=bind,source=/PathToMyProjects/Meshtastic/Meshtastic-device-mybranch,target=/Meshtastic-device-mybranch -p 4403:4403 meshtastic/device bash` + +## Build the native application + +Linux native application should be built inside the container. +For this you must run container with interactive console +"-it", as seen above. + +First, some environment variables need to be set up with command: + + `. ~/.platformio/penv/bin/activate` + +You also want to make some adjustments in the bin/build-all.sh to conform the amd64 build: + +``` + sed -i 's/^BOARDS_ESP32.*/BOARDS_ESP32=""/' bin/build-all.sh + sed -i 's/^BOARDS_NRF52.*/BOARDS_NRF52=""/' bin/build-all.sh + sed -i 's/echo "Building SPIFFS.*/exit/' bin/build-all.sh +``` + +You can build amd64 image with command + +`bin/build-all.sh` + +## Executing the application interactively + +The built binary file should be found under name +`release/latest/bins/universal/meshtastic_linux_amd64`. +If this is not the case, you can also use direct program name: +`.pio/build/native/program` + +To use python cli against exposed port 4403, +type this in the host machine: + +`meshtastic --info --host localhost` + +## Stop the container + +Run this to get the ID: + +`docker ps` + +Stop the container with command: + +`docker kill ` + +> Tip: you can just use the first few characters of the ID in docker commands + diff --git a/docker.txt b/docker.txt deleted file mode 100644 index af2c9c0b0..000000000 --- a/docker.txt +++ /dev/null @@ -1,17 +0,0 @@ -To build: - docker build -t meshtastic/device . - -To run: - docker run --rm -p 4403:4403 meshtastic/device -or, to get a shell on the docker image: - docker run -it meshtastic/device bash - -To use python cli against it: - meshtastic --info --host localhost - -To stop: - # run this to get id - docker ps - # tip: you can just use the first few characters of the id in the next command - docker kill -