diff --git a/README.md b/README.md index f8b6dfae898..67fbcfc67c1 100644 --- a/README.md +++ b/README.md @@ -548,9 +548,13 @@ _rtsp-simple-server_ natively support the Raspberry Pi Camera, enabling high-qua 2. Make sure that the legacy camera stack is disabled. Type `sudo raspi-config`, then go to `Interfacing options`, `enable/disable legacy camera support`, choose `no`. Reboot the system. -3. Make sure that the `libcamera0` package version is at least `0.0.2`, otherwise upgrade it with `sudo apt update && sudo apt install libcamera0`. +If you want to run the standard (non-containerized) version of the server: -If you want to run the standard (non-dockerized) version of the server, just download the server executable and make sure to pick the `arm64` variant if you're using the 64-bit version of the operative system. Then edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content: +1. Make sure that the `libcamera0` package version is at least `0.0.2`, otherwise upgrade it with `sudo apt update && sudo apt install libcamera0`. + +2. download the server executable. If you're using 64-bit version of the operative system, make sure to pick the `arm64` variant. + +3. edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content: ```yml paths: @@ -558,18 +562,16 @@ If you want to run the standard (non-dockerized) version of the server, just dow source: rpiCamera ``` -If you want to run the server with Docker, you need to use the `--privileged` flag and expose some folders: +If you want to run the server with Docker, you need to use the `latest-arm64-rpi` or `latest-armv7-rpi` or `latest-armv6-rpi` image (that already contains libcamera) and set some additional flags: ``` docker run --rm -it \ --network=host \ --privileged \ --tmpfs /dev/shm:exec \ --v /usr:/usr:ro \ --v /lib:/lib:ro \ -v /run/udev:/run/udev:ro \ -e RTSP_PATHS_CAM_SOURCE=rpiCamera \ -aler9/rtsp-simple-server +aler9/rtsp-simple-server:latest-arm64-rpi ``` After starting the server, the camera can be reached on `rtsp://raspberry-pi:8554/cam` or `http://raspberry-pi:8888/cam`. diff --git a/internal/rpicamera/rpicamera.go b/internal/rpicamera/rpicamera.go index 73ef1377396..4d8368e55f3 100644 --- a/internal/rpicamera/rpicamera.go +++ b/internal/rpicamera/rpicamera.go @@ -57,14 +57,12 @@ func checkArch() error { func findLibrary(name string) (string, error) { byts, err := exec.Command("ldconfig", "-p").Output() - if err != nil { - return "", err - } - - for _, line := range strings.Split(string(byts), "\n") { - f := strings.Split(line, " => ") - if len(f) == 2 && strings.Contains(f[1], name+".so") { - return f[1], nil + if err == nil { + for _, line := range strings.Split(string(byts), "\n") { + f := strings.Split(line, " => ") + if len(f) == 2 && strings.Contains(f[1], name+".so") { + return f[1], nil + } } } diff --git a/scripts/dockerhub.mk b/scripts/dockerhub.mk index 7871ca1a4b2..7f64513f4eb 100644 --- a/scripts/dockerhub.mk +++ b/scripts/dockerhub.mk @@ -6,6 +6,28 @@ ENTRYPOINT [ "/rtsp-simple-server" ] endef export DOCKERFILE_DOCKERHUB +define DOCKERFILE_DOCKERHUB_RPI_32 +FROM $(RPI32_IMAGE) +RUN ["cross-build-start"] +RUN apt update && apt install -y --no-install-recommends libcamera0 +RUN ["cross-build-end"] +ARG BINARY +ADD $$BINARY / +ENTRYPOINT [ "/rtsp-simple-server" ] +endef +export DOCKERFILE_DOCKERHUB_RPI_32 + +define DOCKERFILE_DOCKERHUB_RPI_64 +FROM $(RPI64_IMAGE) +RUN ["cross-build-start"] +RUN apt update && apt install -y --no-install-recommends libcamera0 +RUN ["cross-build-end"] +ARG BINARY +ADD $$BINARY / +ENTRYPOINT [ "/rtsp-simple-server" ] +endef +export DOCKERFILE_DOCKERHUB_RPI_64 + dockerhub: $(eval export DOCKER_CLI_EXPERIMENTAL=enabled) $(eval VERSION := $(shell git describe --tags)) @@ -30,6 +52,13 @@ dockerhub: -t aler9/rtsp-simple-server:latest-armv6 \ --push + echo "$$DOCKERFILE_DOCKERHUB_RPI_32" | docker buildx build . -f - \ + --platform=linux/arm/v6 \ + --build-arg BINARY="$$(echo binaries/*linux_armv6.tar.gz)" \ + -t aler9/rtsp-simple-server:$(VERSION)-armv6-rpi \ + -t aler9/rtsp-simple-server:latest-armv6-rpi \ + --push + echo "$$DOCKERFILE_DOCKERHUB" | docker buildx build . -f - \ --platform=linux/arm/v7 \ --build-arg BINARY="$$(echo binaries/*linux_armv7.tar.gz)" \ @@ -37,6 +66,13 @@ dockerhub: -t aler9/rtsp-simple-server:latest-armv7 \ --push + echo "$$DOCKERFILE_DOCKERHUB_RPI_32" | docker buildx build . -f - \ + --platform=linux/arm/v7 \ + --build-arg BINARY="$$(echo binaries/*linux_armv7.tar.gz)" \ + -t aler9/rtsp-simple-server:$(VERSION)-armv7-rpi \ + -t aler9/rtsp-simple-server:latest-armv7-rpi \ + --push + echo "$$DOCKERFILE_DOCKERHUB" | docker buildx build . -f - \ --platform=linux/arm64/v8 \ --build-arg BINARY="$$(echo binaries/*linux_arm64v8.tar.gz)" \ @@ -44,6 +80,13 @@ dockerhub: -t aler9/rtsp-simple-server:latest-arm64v8 \ --push + echo "$$DOCKERFILE_DOCKERHUB_RPI_64" | docker buildx build . -f - \ + --platform=linux/arm64/v8 \ + --build-arg BINARY="$$(echo binaries/*linux_arm64v8.tar.gz)" \ + -t aler9/rtsp-simple-server:$(VERSION)-arm64v8-rpi \ + -t aler9/rtsp-simple-server:latest-arm64v8-rpi \ + --push + docker manifest create aler9/rtsp-simple-server:$(VERSION) \ $(foreach ARCH,amd64 armv6 armv7 arm64v8,aler9/rtsp-simple-server:$(VERSION)-$(ARCH)) docker manifest push aler9/rtsp-simple-server:$(VERSION)