modified docker command to run from project root, so go mod is not required in examples

This commit is contained in:
swdee
2025-04-07 12:47:26 +12:00
parent 89ffa6b3a4
commit 8e80a50343
3 changed files with 5 additions and 17 deletions
+5 -5
View File
@@ -38,17 +38,17 @@ You can use this image to run your own application or the go-rknnlite examples.
to run the [MobileNet Demo](example/mobilenet) use the following commands.
```
cd example/mobilenet
# from project root directory
docker run --rm \
--device /dev/dri:/dev/dri \
-v "$(pwd):/go/src/app" \
-v "$(pwd)/../data:/go/src/data" \
-v "$(pwd)/example/data:/go/src/data" \
-v "/usr/include/rknn_api.h:/usr/include/rknn_api.h" \
-v "/usr/lib/librknnrt.so:/usr/lib/librknnrt.so" \
-w /go/src/app \
swdee/go-rknnlite:latest \
go run mobilenet.go
go run ./example/mobilenet/mobilenet.go
```
An explanation of each parameter in the docker command is as follows;
@@ -57,12 +57,12 @@ An explanation of each parameter in the docker command is as follows;
|------------------------------------------------------|-----------------------------------------------------------------|
| --device /dev/dri:/dev/dri | Pass the NPU device through into the container |
| -v "$(pwd):/go/src/app" | Mount the current Go application source code into the container |
| -v "$(pwd)/../data:/go/src/data" | Mount the example/data files into the container |
| -v "$(pwd)/example/data:/go/src/data" | Mount the example/data files into the container |
| -v "/usr/include/rknn_api.h:/usr/include/rknn_api.h" | Include the rknn-toolkit2 header files |
| -v "/usr/lib/librknnrt.so:/usr/lib/librknnrt.so" | Include the rknn-toolkit2 shared library |
| -w /go/src/app | Set the working directory in docker container |
| swdee/go-rknnlite:latest | Use the prebuilt go-rknnlite docker image |
| go run mobilenet.go | Run the mobilenet.go demo |
| go run ./example/mobilenet/mobilenet.go | Run the mobilenet.go demo |
To view the OpenCV configuration in this prebuilt docker image run.
-8
View File
@@ -1,8 +0,0 @@
module mobilenet
go 1.22.8
require (
github.com/swdee/go-rknnlite v0.0.0-20250401212925-399f18c77ec7
gocv.io/x/gocv v0.41.0
)
-4
View File
@@ -1,4 +0,0 @@
github.com/swdee/go-rknnlite v0.0.0-20250401212925-399f18c77ec7 h1:l9IeY+65tm/QYa5wwcasSznwqj+EpC6br7oxHtnbZzE=
github.com/swdee/go-rknnlite v0.0.0-20250401212925-399f18c77ec7/go.mod h1:/qJ6ExxC28AARBXGFDWTcjq4A6e6EDhw1IQm9x3sUJ0=
gocv.io/x/gocv v0.41.0 h1:KM+zRXUP28b6dHfhy+4JxDODbCNQNtLg8kio+YE7TqA=
gocv.io/x/gocv v0.41.0/go.mod h1:zYdWMj29WAEznM3Y8NsU3A0TRq/wR/cy75jeUypThqU=