greatscottgadgets / packetry

A fast, intuitive USB 2.0 protocol analysis application for use with Cynthion.
BSD 3-Clause "New" or "Revised" License
123 stars 24 forks source link

Provide user-ready Docker container for running Packetry #159

Closed xairy closed 1 month ago

xairy commented 1 month ago

There's a container used for CI, but I couldn't figure out if it's possible to use it as is for running Packetry.

To make it work, I had to:

Apply the following patch:

diff --git a/appimage/docker/Dockerfile b/appimage/docker/Dockerfile
index 1cfbeb2..26368b5 100644
--- a/appimage/docker/Dockerfile
+++ b/appimage/docker/Dockerfile
@@ -196,7 +196,7 @@ ENV NODE_VERSION="$NODE_VERSION_DEFAULT"
 # See: https://github.com/actions/checkout/issues/1014

 ENV RUNNER="root"
-ENV HOME="/github/home"
+ENV HOME="/home/runner"

 # Assuage GitHub Actions by setting root user home directory to /github/home
 RUN sed -i'' 's@root:x:0:0:root:/root:/bin/bash@root:x:0:0:root:/github/home:/bin/bash@g' /etc/passwd

Build the container via docker build . in appimage/docker and tag it via docker tag CONTAINER_ID packetry.

Run the container:

docker run --init -it --rm --privileged --name packetry --cpus 2 --memory 4g -e MAXMEM=4G -e DISPLAY=$DISPLAY -h $HOSTNAME -v /tmp/.X11-unix:/tmp/.X11-unix -v "/home/$(whoami)/.Xauthority:/home/runner/.Xauthority" -v /dev/bus/usb:/dev/bus/usb packetry

Then, inside of /home/runner in the container:

git clone https://github.com/greatscottgadgets/packetry.git
cd packetry
cargo build
./target/.../packetry
martinling commented 1 month ago

We have no plans to ship a Docker container for running Packetry, and don't really see a need for one.

We already have AppImage builds, if you want a way to run Packetry without installing dependencies.

The Dockerfile in appimage/docker is there so that we can store the result of creating the build environment used for the AppImage, and keep that as a Docker image to speed up future CI runs. It's not intended to be used for any other purpose, and it's not a good solution for containerising the application.