diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dc52248 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM node:22-alpine + +WORKDIR /app + +COPY package*.json ./ + +RUN npm install + +COPY . . + +CMD ["sh", "-c", "node index.mjs ${DEVICE:-/dev/ttyACM0}"] \ No newline at end of file diff --git a/README.md b/README.md index 0dce9bf..ce71f23 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,14 @@ git clone https://github.com/recrof/map.meshcore.dev-uploader cd map.meshcore.dev-uploader npm install . ``` - -## Usage +### Usage 1. Connect working MeshCore companion usb into the computer 2. run `node index.mjs [usb_port]` + +## Running with Docker +After cloning the repo, build and run the docker image with +```sh +docker-compose build +docker-compose up +``` +You will be able to inspect the logs. Once everything is working correctly, run the container with ``docker-compose up -d`` to run it in the background. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b0204b7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +services: + map-uploader: + build: . + environment: + # Set to the appropriate device for your setup, either /dev/ttyACM0 if connected by USB to a USB companion or IP:port if connected over network to a wifi companion + - DEVICE=/dev/ttyACM0 + restart: unless-stopped + # Only necessary for accessing USB devices, such as a USB companion + privileged: true + # Adjust according to your setup, but this is the default + devices: + - /dev/ttyACM0:/dev/ttyACM0 \ No newline at end of file