When I run image manualy using this command, works without problem:
run --rm -it --device /dev/video0 -p 8554:8554 --entrypoint /init image_name
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
2022/03/30 13:35:58 Starting Rpos
cat: /proc/device-tree/model: No such file or directory
Read IP address 172.17.0.3 from eth0
Manufacturer : Raspberry Pi
Model : 2 B
HardwareId :
SerialNumber : 00000000d83271ec
FirmwareVersion : 2.1.0
Starting camera settings webserver on http://172.17.0.3:8081/
v4l2ctl.json does not exist yet or invalid.
Binding DeviceService to http://172.17.0.3:8081/onvif/device_service
Binding MediaService to http://172.17.0.3:8081/onvif/media_service
Binding PTZService to http://172.17.0.3:8081/onvif/ptz_service
Binding ImagingService to http://172.17.0.3:8081/onvif/imaging_service
discovery_service started
imaging_service started
ptz_service started
device_service started
Starting Live555 rtsp server
media_service started
When I build addon and start I get error:
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
2022/03/30 15:03:15 Starting Rpos
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '/data/rpos/rpos.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v17.8.0
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
Dockerfile
FROM ghcr.io/home-assistant/armhf-base-raspbian:bullseye
# Install requirements for add-on
RUN apt-get update && apt-get install -y \
nodejs \
npm \
liblivemedia-dev \
liblivemedia-dev \
liblog4cpp5-dev \
cmake \
libasound2-dev \
v4l-utils
# So let's set it to our add-on persistent data directory.
WORKDIR /data
# install onvif server
# install npm and node.js (latest 17 in 26.3.22)
RUN npm install -g n \
&& n install 17
RUN git clone https://github.com/BreeeZe/rpos.git \
&& cd rpos \
&& npm install
# So let's set it to our add-on persistent data/rpos directory.
WORKDIR /data/rpos
RUN npx gulp
# instal v4l2rtspserver
RUN git clone https://github.com/mpromonet/v4l2rtspserver.git \
&& cd v4l2rtspserver/ \
&& cmake . \
&& make \
&& make install
COPY rposConfig.json /data/rpos/
COPY run /etc/services.d/rpos/run
COPY finish /etc/services.d/rpos/finish
ENTRYPOINT ["/init"]
config.yaml
name: "Raspberry camera ONVIF server add-on"
description: "ONVIF server from raspberry pi camera"
version: "0.0.1a"
slug: "rpi-camera-rtsp-server-onvif"
arch:
- armhf
- armv7
ports:
8554/tcp: 8554
ports_description:
8554/tcp: Web interface (Not required for Ingress)
video: true
run
#!/usr/bin/with-contenv bashio
echo "$( date +'%Y/%m/%d %H:%M:%S' ) Starting Rpos"
cd /data/rpos
exec /usr/local/bin/node /data/rpos/rpos.js
finish
#!/usr/bin/execlineb -S1
if { s6-test ${1} -ne 0 }
if { s6-test ${1} -ne 256 }
s6-svscanctl -t /var/run/s6/services