add docker images with libcamera included (#1110)

This commit is contained in:
aler9 2022-12-12 13:52:09 +01:00
parent ff12605106
commit 3b5efb25a3
3 changed files with 57 additions and 14 deletions

View File

@ -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`.

View File

@ -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
}
}
}

View File

@ -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)