Open johnatank opened 2 years ago
I will take a look at your suggestions next week, I think. But I'm unsure how you get a complete SRS image rebuild after changing the config file. All steps except copying the modified config file should be cached:
> docker-compose build hikvision-srs-server
[+] Building 1.8s (15/15) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.07kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 34B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:latest 1.5s
=> [auth] library/ubuntu:pull token for registry-1.docker.io 0.0s
=> [1/9] FROM docker.io/library/ubuntu:latest@sha256:20fa2d7bb4de7723f542be5923b06c4d704370f0390e4ae9e1c833c8785644c1 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 596B 0.0s
=> CACHED [2/9] RUN ln -snf /usr/share/zoneinfo/Europe/Kiev /etc/localtime && echo Europe/Kiev > /etc/timezone 0.0s
=> CACHED [3/9] RUN sed -i 's/^deb http:\/\/archive\./deb http:\/\/ua\.archive\./' /etc/apt/sources.list 0.0s
=> CACHED [4/9] RUN apt update && apt upgrade --yes && apt autoremove --yes && apt install --yes --no-install-recommends bash htop git tzdata sudo unzip openssl iputils-ping net-tools && rm -rf /v 0.0s
=> CACHED [5/9] RUN git config --global http.sslVerify false && git config --global http.postBuffer 1048576000 0.0s
=> CACHED [6/9] RUN git clone -b 4.0release https://github.com/ossrs/srs.git 0.0s
=> CACHED [7/9] WORKDIR /srs/trunk 0.0s
=> CACHED [8/9] RUN apt update && apt install --yes gcc g++ libffi-dev libjpeg-dev zlib1g-dev build-essential libtool automake patch perl && ./configure --srt=on --jobs=$(nproc) && make -j$(nproc) && apt auto 0.0s
=> [9/9] COPY srs_prod/hik-docker.conf ./conf/hik-docker.conf 0.1s
=> exporting to image 0.1s
=> => exporting layers 0.0s
=> => writing image sha256:f5552cde3e3e8101d4340b23c2bfbffeefdfd5c92a93036031c1d467f62c8bcb 0.0s
=> => naming to docker.io/library/hik-hikvision-srs-server
Yes, I didn't meant rebuild of image in the way - each image layer would be rebuilt. You are correct - docker would use cache for all unchanged layers. I mean docker build must be called each time configuration is changed. I believe it makes more sense to store config files in volumes.
Hi team,
Couple items I noticed while deploying and using this: 1) is it needed to build a new image for srs considering the public image is already available and has lesser size? I used ossrs/srs:4 with this bot and it worked fine (ossrs/srs:5 didn't work). If compatibility is a concern - exact compatible version can be used as image tag to avoid upgrading to non compatible release;
2) it would make sense to create bind volume to map configuation files, i.e.:
/hikvision-camera-bot/srs/conf/ and /hikvision-camera-bot/hikvision-camera-bot/configs/ would host docker.conf for SRS and configuration files for bot accordingly.
If not, image rebuild is required on each change in configuration file;
3) looks like all streams (youtube, dvr, telegram, srs were tested) are hardcoded to hikvision_srs_server container name (or service name if docker-compose is used);
4) for Telegram stream, I had to change acodec codec to aac in encoding-templates.json to make it working:
Maybe that's an issue with my camera model (DS-2CV2Q21FD-IW) only.
Thanks, Maksym