Dockerize the application

This commit is contained in:
David
2025-10-18 20:28:43 +02:00
parent 69ccc65bab
commit 9d58588fa1
3 changed files with 32 additions and 2 deletions

11
Dockerfile Normal file
View File

@@ -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}"]

View File

@@ -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.

12
docker-compose.yml Normal file
View File

@@ -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