ARG RESTREAMER_UI_IMAGE=datarhei/restreamer-ui:latest ARG CORE_IMAGE=core-core ARG FFMPEG_IMAGE=nextream/ffmpeg-ndi:v5.3 FROM $RESTREAMER_UI_IMAGE AS restreamer-ui FROM $CORE_IMAGE AS core-stage FROM $FFMPEG_IMAGE AS final # Copy UI and core files into the ffmpeg-based final image so libc/libs match COPY --from=restreamer-ui /ui/build /core/ui ADD https://raw.githubusercontent.com/datarhei/restreamer/2.x/CHANGELOG.md /core/ui/CHANGELOG.md COPY ./run.sh /core/bin/run.sh COPY ./ui-root /core/ui-root COPY --from=core-stage /core /core # Start helper script: if host sockets are not mounted, try starting dbus/avahi, # otherwise rely on host-provided daemons. This avoids starting system daemons when # the host sockets are mounted into the container. RUN printf '%s\n' '#!/bin/sh' 'set -eux' '' 'if [ "$(id -u)" -ne 0 ]; then' ' echo "starting as non-root, avahi may not work fully"' 'fi' '' '# if host dbus socket exists, do not start dbus-daemon' 'if [ ! -S /var/run/dbus/system_bus_socket ]; then' ' if ! pgrep -x dbus-daemon >/dev/null 2>&1; then' ' dbus-daemon --system --fork || true' ' fi' 'fi' '' '# if host avahi socket exists, do not start avahi-daemon' 'if [ ! -S /var/run/avahi-daemon/socket ]; then' ' if [ -x /usr/sbin/avahi-daemon ]; then' ' avahi-daemon --no-drop-root --daemonize || true' ' fi' 'fi' '' '# exec core run script' 'exec /core/bin/run.sh' > /core/bin/start.sh && chmod +x /core/bin/start.sh || true ENV CORE_CONFIGFILE=/core/config/config.json ENV CORE_DB_DIR=/core/config ENV CORE_ROUTER_UI_PATH=/core/ui ENV CORE_STORAGE_DISK_DIR=/core/data ENV CORE_FFMPEG_BINARY=/usr/local/bin/ffmpeg-core #ENV CORE_API_AUTH_ENABLE=false ENV CORE_RTMP_ENABLE=true ENV CORE_SRT_ENABLE=true ENV CORE_PLAYOUT_ENABLE=true ENV CORE_METRICS_ENABLE=true ENV CORE_METRICS_ENABLE_PROMETHEUS=true EXPOSE 8080/tcp EXPOSE 8181/tcp EXPOSE 1935/tcp EXPOSE 1936/tcp EXPOSE 6000/udp EXPOSE 8555/tcp EXPOSE 8554/tcp VOLUME ["/core/data", "/core/config"] ENTRYPOINT ["/core/bin/start.sh"] WORKDIR /core # Provide ffmpeg-core wrapper to normalize `-version` output for Core RUN printf '%s\n' '#!/bin/sh' 'if echo "$$@" | grep -q "-version"; then' ' ver=$(/usr/bin/ffmpeg -hide_banner -version 2>/dev/null | sed -n "1p" | sed "s/^[^0-9]*\([0-9]\+\.[0-9]\+\).*/\1/")' ' if [ -z "${ver}" ]; then ver="0.0"; fi' ' echo "ffmpeg version ${ver}"' ' exit 0' 'fi' 'exec /usr/bin/ffmpeg "$$@"' > /usr/local/bin/ffmpeg-core && chmod +x /usr/local/bin/ffmpeg-core || true