From 820f8e4aebb0e8172de57cd0d6acaaa33e865153 Mon Sep 17 00:00:00 2001 From: oleg Date: Thu, 9 Apr 2026 17:02:49 +0300 Subject: [PATCH] add docker --- Dockerfile | 20 ++++++++++++++++++++ README.md | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3a807e5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM manjarolinux/base:latest + +RUN pacman -Syu --noconfirm && \ + pacman -S --noconfirm \ + clang \ + cmake \ + make \ + git \ + boost \ + sqlite \ + systemd-libs \ + zlib && \ + pacman -Scc --noconfirm + +WORKDIR /app +COPY . . + +RUN cmake -B build -S . && cmake --build build -j$(nproc) + +ENTRYPOINT ["./build/canscope"] diff --git a/README.md b/README.md index 18f0b84..34903c3 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,23 @@ cmake -B build -S . && cmake --build build -j$(nproc) Binary: `build/canscope` +### Docker + +```bash +docker build -t canscope . +``` + +```bash +# TUI mode -- requires terminal and CAN interface access +docker run -it --network=host canscope -e "candump can0" -j1939 /app/thirdparty/j1939da_2018.xlsx + +# Headless mode +docker run --network=host canscope -hl -e "candump can0" -j1939 /app/thirdparty/j1939da_2018.xlsx + +# Read from stdin +candump can0 | docker run -i canscope -j1939 /app/thirdparty/j1939da_2018.xlsx -hl +``` + ## Usage ```bash @@ -41,6 +58,21 @@ Binary: `build/canscope` # Headless -- JSON to file ./build/canscope -hl -e "candump can0" -j1939 thirdparty/j1939da_2018.xlsx -of output.json +# Read from stdin (pipe) +candump can0 | ./build/canscope -j1939 thirdparty/j1939da_2018.xlsx + +# Headless with stdin +candump can0 | ./build/canscope -hl -j1939 thirdparty/j1939da_2018.xlsx + +# Docker -- TUI with CAN interface access +docker run -it --network=host canscope -e "candump can0" -j1939 /app/thirdparty/j1939da_2018.xlsx + +# Docker -- headless +docker run --network=host canscope -hl -e "candump can0" -j1939 /app/thirdparty/j1939da_2018.xlsx + +# Docker -- read from stdin +candump can0 | docker run -i canscope -hl -j1939 /app/thirdparty/j1939da_2018.xlsx + # Record to SQLite database ./build/canscope -rec -db recording.db -e "candump can0" -j1939 thirdparty/j1939da_2018.xlsx @@ -48,6 +80,8 @@ Binary: `build/canscope` ./build/canscope -rec -db recording.db -tui -e "candump can0" -j1939 thirdparty/j1939da_2018.xlsx ``` +> **Note:** J1939 decoding has only been tested with the Digital Annex 2018 edition. Other editions may work but are not guaranteed. + ### CLI flags | Flag | Long form | Description | @@ -101,5 +135,5 @@ candump / other CAN source ## Roadmap - **Cross-platform support** -- Windows and macOS in addition to Linux -- **Docker deployment** -- pre-built image for quick setup without manual compilation +- ~~**Docker deployment** -- pre-built image for quick setup without manual compilation~~ - **CANopen protocol support** -- CANopen decoding alongside J1939