Files
scrypted/docker/Dockerfile.common
Ted Hong 09533b118e Add Avahi Support (#323)
* initial avahi support

This commit adds support for the Avahi advertiser with Scrypted. It also adds the s6 process supervisor to facilitate future service additions.

* universal s6

This commit attempts to fix the issue where Avahi doesn't start on non-x86_64 architectures.

* consistency updates

This commit updates the wording in certain s6 run files to be consistent.

* fix s6 overlay version argument

This commit fixes the S6_OVERLAY_VERSION argument being prematurely collected by moving it after the FROM command.

* correct shebangs

This commit corrects the shebangs of all s6 service scripts to register with s6 instead of just running under bash.

* register services with s6

This commit adds two empty files that correspond to the dbus and avahi services started by s6. Without these files, s6 does not initialize daemons to keep dbus and avahi running.

* fix permissions and shebangs

This commit fixes the permissions on the service scripts that s6 is responsible for starting. It also reverts the shebang back to bash because many script utilities aren't available when running under execlineb.

* organize added features by block

This commit organizes all added lines into separate blocks for both avahi and s6-overlay. Resolves some of koush's review comments on #323.
2022-08-22 08:31:36 -07:00

87 lines
2.6 KiB
Docker

ARG BASE="16-bullseye"
FROM node:${BASE}
# Coral Edge TPU sources.list
# https://coral.ai/docs/accelerator/get-started/#runtime-on-linux
RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get -y install software-properties-common apt-utils
RUN apt-get -y update
# base development stuff
RUN apt-get -y install \
build-essential \
gcc \
gir1.2-gtk-3.0 \
libavahi-compat-libdnssd-dev \
libcairo2-dev \
libgirepository1.0-dev \
libglib2.0-dev \
libjpeg-dev \
libgif-dev \
libopenjp2-7 \
libpango1.0-dev \
librsvg2-dev \
pkg-config
# gstreamer native https://gstreamer.freedesktop.org/documentation/installing/on-linux.html?gi-language=c#install-gstreamer-on-ubuntu-or-debian
RUN apt-get -y install \
gstreamer1.0-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-alsa
# python native
RUN apt-get -y install \
python3 \
python3-dev \
python3-gi \
python3-gst-1.0 \
python3-matplotlib \
python3-numpy \
python3-opencv \
python3-pil \
python3-pip \
python3-setuptools \
python3-skimage \
python3-wheel
# Coral Edge TPU
RUN apt-get -y install \
libedgetpu1-std
# python pip
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install aiofiles debugpy typing_extensions typing
ENV SCRYPTED_DOCKER_SERVE="true"
ENV SCRYPTED_CAN_RESTART="true"
ENV SCRYPTED_VOLUME="/server/volume"
ENV SCRYPTED_INSTALL_PATH="/server"
# avahi advertiser support
RUN apt-get -y install \
libnss-mdns \
avahi-discover \
libavahi-compat-libdnssd-dev
# copy configurations and scripts
COPY fs /
# s6 process supervisor
ARG S6_OVERLAY_VERSION=3.1.1.2
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
RUN case "$(uname -m)" in \
x86_64) S6_ARCH='x86_64';; \
armv7l) S6_ARCH='armhf';; \
aarch64) S6_ARCH='aarch64';; \
*) echo "Your system architecture isn't supported."; exit 1 ;; \
esac \
&& cd /tmp \
&& set -x \
&& curl -SLOf https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz \
&& tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz \
&& curl -SLOf https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz \
&& tar -C / -Jxpf /tmp/s6-overlay-${S6_ARCH}.tar.xz
ENTRYPOINT ["/init"]