diff --git a/build/Dockerfile b/build/Dockerfile index 0f25a274..bd9a801f 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -9,6 +9,7 @@ COPY --from=builder /tmp/ustreamer/ustreamer /tmp/ustreamer/ustreamer-dump /usr/ COPY --from=builder /tmp/wheel/*.whl /tmp/wheel/ COPY --from=builder /tmp/ustreamer/libjanus_ustreamer.so /usr/lib/ustreamer/janus/ COPY --from=builder /usr/lib/janus/transports/* /usr/lib/janus/transports/ +COPY --from=builder /opt/usr/ /usr/ ARG TARGETARCH @@ -43,12 +44,15 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.lis libasound2 \ nano \ unzip \ - libavcodec59 \ - libavformat59 \ - libavutil57 \ - libswscale6 \ - libavfilter8 \ - libavdevice59 \ + && if [ ${TARGETARCH} != arm64 ]; then \ + apt-get install -y --no-install-recommends \ + libavcodec59 \ + libavformat59 \ + libavutil57 \ + libswscale6 \ + libavfilter8 \ + libavdevice59; \ + fi \ && if [ ${TARGETARCH} != arm ] && [ ${TARGETARCH} != arm64 ]; then \ apt-get install -y --no-install-recommends \ ffmpeg \ diff --git a/build/Dockerfile-stage-0 b/build/Dockerfile-stage-0 index 278e5712..0a72b6f3 100644 --- a/build/Dockerfile-stage-0 +++ b/build/Dockerfile-stage-0 @@ -49,27 +49,36 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.lis libusb-1.0-0-dev \ libldap2-dev \ libsasl2-dev \ - ffmpeg \ - libavcodec-dev \ - libavformat-dev \ - libavutil-dev \ - libswscale-dev \ - libavfilter-dev \ - libavdevice-dev \ - vainfo \ - libva-dev \ - libva-drm2 \ - libva-x11-2 \ libdrm-dev \ mesa-va-drivers \ mesa-vdpau-drivers \ v4l-utils \ libv4l-dev \ + && if [ ${TARGETARCH} != arm64 ]; then \ + apt-get install -y --no-install-recommends \ + ffmpeg \ + libavcodec-dev \ + libavformat-dev \ + libavutil-dev \ + libswscale-dev \ + libavfilter-dev \ + libavdevice-dev; \ + fi \ && if [ ${TARGETARCH} != arm ] && [ ${TARGETARCH} != arm64 ]; then \ apt-get install -y --no-install-recommends \ + vainfo \ + libva-dev \ + libva-drm2 \ + libva-x11-2 \ intel-media-va-driver \ i965-va-driver; \ fi \ + && if [ ${TARGETARCH} = arm64 ]; then \ + apt-get install -y --no-install-recommends \ + ninja-build \ + zlib1g-dev \ + libswresample-dev; \ + fi \ && apt clean \ && rm -rf /var/lib/apt/lists/* @@ -131,6 +140,27 @@ RUN git clone --depth=1 https://gitlab.freedesktop.org/libnice/libnice /tmp/libn && cd /tmp \ && rm -rf /tmp/janus-gateway +# 编译 Rockchip MPP、RGA 和 FFmpeg(仅 arm64) +RUN if [ ${TARGETARCH} = arm64 ]; then \ + git clone --depth=1 https://github.com/rockchip-linux/mpp.git /tmp/mpp \ + && cd /tmp/mpp \ + && cmake -DRKPLATFORM=ON -DCMAKE_INSTALL_PREFIX=/usr . \ + && make -j$(nproc) \ + && make install \ + && make install DESTDIR=/opt \ + && git clone --depth=1 -b 1.9.1 https://github.com/airockchip/librga /tmp/librga \ + && cd /tmp/librga \ + && meson setup --prefix=/usr rkrga_build \ + && ninja -C rkrga_build install \ + && DESTDIR=/opt ninja -C rkrga_build install \ + && git clone --depth=1 https://github.com/nyanmisaka/ffmpeg-rockchip.git /tmp/ffmpeg-rockchip \ + && cd /tmp/ffmpeg-rockchip \ + && ./configure --prefix=/usr --enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga --enable-alsa --enable-libv4l2 --enable-libx264 --enable-v4l2-m2m --disable-programs \ + && make -j$(nproc) \ + && make install \ + && make install DESTDIR=/opt; \ + fi + # 编译 ustreamer RUN echo "Building ustreamer with timestamp cache bust" \ && sed --in-place --expression 's|^#include "refcount.h"$|#include "../refcount.h"|g' /usr/include/janus/plugins/plugin.h \ diff --git a/build/functions/install.sh b/build/functions/install.sh index ba4acb0d..5b49d5ed 100755 --- a/build/functions/install.sh +++ b/build/functions/install.sh @@ -108,7 +108,7 @@ install_base_packages() { iptables network-manager curl kmod libmicrohttpd12 libjansson4 libssl3 \\ libsofia-sip-ua0 libglib2.0-0 libopus0 libogg0 libcurl4 libconfig9 \\ python3-pip net-tools libavcodec59 libavformat59 libavutil57 libswscale6 \\ - libavfilter8 libavdevice59 v4l-utils libv4l-0 && \\ + libavfilter8 libavdevice59 v4l-utils libv4l-0 nano unzip && \\ apt clean && \\ rm -rf /var/lib/apt/lists/* "