-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (42 loc) · 2.12 KB
/
Copy pathDockerfile
File metadata and controls
49 lines (42 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
FROM debian:bullseye-slim AS stage1
# ZLMediaKit only defines ENABLE_FFMPEG when pkg-config finds ALL of avutil/avcodec/swscale/
# swresample/avfilter (CMakeLists.txt). libswresample-dev (NOT libresample-dev) and
# libavfilter-dev are required, else -DENABLE_FFMPEG=true silently flips OFF and WebRTC
# can't transcode AAC->Opus (no audio).
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential cmake git curl wget vim ca-certificates tzdata libssl-dev \
libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libswresample-dev libavfilter-dev ffmpeg \
&& apt-get clean
RUN mkdir -p /opt/media
WORKDIR /opt/media
# libsrtp
# https://github.com/cisco/libsrtp/archive/refs/tags/v2.5.0.tar.gz
RUN wget -O libsrtp-2.5.0.tar.gz https://github.com/cisco/libsrtp/archive/refs/tags/v2.5.0.tar.gz && \
tar -zxvf libsrtp-2.5.0.tar.gz && \
cd libsrtp-2.5.0 && \
./configure --enable-openssl && \
make -j $(nproc) && make install
ARG ARG_BRANCH=master
ENV ARG_BRANCH=${ARG_BRANCH}
# ZLMediaKit's default .gitmodules points submodules at gitee.com, which rate-limits /
# blocks GitHub Actions runner IPs (401 -> git prompts for a username -> non-interactive
# clone failure). The repo ships .gitmodules_github with the same submodules on GitHub;
# swap to it before fetching submodules.
RUN git clone --depth=1 -b ${ARG_BRANCH} https://github.com/ZLMediaKit/ZLMediaKit.git && \
cd ZLMediaKit && \
cp .gitmodules_github .gitmodules && git submodule sync && \
git submodule update --init --recursive && \
mkdir -p build release/linux/Release/
WORKDIR /opt/media/ZLMediaKit/build
RUN cmake -DCMAKE_BUILD_TYPE=Release \
-DOPENSSL_USE_STATIC_LIBS=ON \
-DENABLE_OBJCOPY=OFF \
-DENABLE_WEBRTC=true \
-DENABLE_FFMPEG=true .. && \
make -j $(nproc)
FROM scratch AS export-stage
COPY --from=stage1 /opt/media/ZLMediaKit/release/linux/Release/MediaServer bin/MediaServer
COPY --from=stage1 /opt/media/ZLMediaKit/api/include/** include/
COPY --from=stage1 /opt/media/ZLMediaKit/release/linux/Release/*.so lib/
COPY --from=stage1 /opt/media/ZLMediaKit/release/linux/Release/*.a lib/