Closed deadprogram closed 2 months ago
I have added another container called gocv-static-builder
intended to help build user projects.
Build it like this:
docker build -f Dockerfile-static-builder -t gocv-static-builder .
Use it like this:
$ docker run --rm -e "BINARYNAME=mjpeg-streamer" -e "SRCPATH=./cmd/mjpeg-streamer" -v $(pwd):/src -v $(pwd)/build:/build -a stdout -a stderr gocv-static-builder
$ ls -l ./build/mjpeg-streamer
-rwxr-xr-x 1 root root 74471944 sep 18 12:06 ./build/mjpeg-streamer
Now you can run the static binary like this:
$ ./build/mjpeg-streamer 0 localhost:8080
Did some further work and now the docker image is multiarch for both arm64 and amd64.
$ docker run --platform=linux/arm64 gocv-static
gocv version: 0.38.0
opencv lib version: 4.10.0
$ docker run --platform=linux/amd64 gocv-static
gocv version: 0.38.0
opencv lib version: 4.10.0
This PR modifies the static build capability for GoCV to correctly work to build fully statically linked binaries for Linux.
To build the static binary:
Once it is built: