ZLMediaKit/dockerfile

95 lines
2.7 KiB
Plaintext
Raw Permalink Normal View History

FROM ubuntu:20.04 AS build
2021-09-13 21:16:22 +08:00
ARG MODEL
#shell,rtmp,rtsp,rtsps,http,https,rtp
EXPOSE 1935/tcp
EXPOSE 554/tcp
EXPOSE 80/tcp
EXPOSE 443/tcp
EXPOSE 10000/udp
EXPOSE 10000/tcp
EXPOSE 8000/udp
EXPOSE 8000/tcp
2022-06-19 19:39:48 +08:00
EXPOSE 9000/udp
2021-09-13 21:16:22 +08:00
2022-06-19 15:54:30 +08:00
# ADD sources.list /etc/apt/sources.list
RUN apt-get update && \
2021-09-13 21:16:22 +08:00
DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
curl \
vim \
wget \
ca-certificates \
tzdata \
libssl-dev \
libmysqlclient-dev \
libx264-dev \
libfaac-dev \
gcc \
g++ \
2022-07-18 16:54:38 +08:00
libavcodec-dev libavutil-dev libswscale-dev libresample-dev \
libsdl-dev libusrsctp-dev \
2022-06-19 15:54:30 +08:00
gdb && \
2021-09-13 21:16:22 +08:00
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
2021-09-13 21:16:22 +08:00
RUN mkdir -p /opt/media
COPY . /opt/media/ZLMediaKit
WORKDIR /opt/media/ZLMediaKit
# 3rdpart init
WORKDIR /opt/media/ZLMediaKit/3rdpart
RUN wget https://mirror.ghproxy.com/https://github.com/cisco/libsrtp/archive/v2.3.0.tar.gz -O libsrtp-2.3.0.tar.gz && \
tar xfv libsrtp-2.3.0.tar.gz && \
mv libsrtp-2.3.0 libsrtp && \
cd libsrtp && ./configure --enable-openssl && make -j $(nproc) && make install
2021-09-13 21:16:22 +08:00
#RUN git submodule update --init --recursive && \
2021-09-13 21:16:22 +08:00
RUN mkdir -p build release/linux/${MODEL}/
WORKDIR /opt/media/ZLMediaKit/build
2022-07-18 16:54:38 +08:00
RUN cmake -DCMAKE_BUILD_TYPE=${MODEL} -DENABLE_WEBRTC=true -DENABLE_FFMPEG=true -DENABLE_TESTS=false -DENABLE_API=false .. && \
make -j $(nproc)
2021-09-13 21:16:22 +08:00
FROM ubuntu:20.04
2021-09-13 21:16:22 +08:00
ARG MODEL
2022-06-19 15:54:30 +08:00
# ADD sources.list /etc/apt/sources.list
RUN apt-get update && \
2021-09-13 21:16:22 +08:00
DEBIAN_FRONTEND="noninteractive" \
apt-get install -y --no-install-recommends \
vim \
wget \
ca-certificates \
tzdata \
curl \
libssl-dev \
libx264-dev \
libfaac-dev \
ffmpeg \
gcc \
g++ \
2022-07-18 16:54:38 +08:00
libavcodec-dev libavutil-dev libswscale-dev libresample-dev \
libsdl-dev libusrsctp-dev \
2022-06-19 15:54:30 +08:00
gdb && \
2021-09-13 21:16:22 +08:00
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone && \
mkdir -p /opt/media/bin/www
WORKDIR /opt/media/bin/
2022-08-01 17:33:58 +08:00
COPY --from=build /opt/media/ZLMediaKit/release/linux/${MODEL}/MediaServer /opt/media/ZLMediaKit/default.pem /opt/media/bin/
2021-09-13 21:16:22 +08:00
COPY --from=build /opt/media/ZLMediaKit/release/linux/${MODEL}/config.ini /opt/media/conf/
COPY --from=build /opt/media/ZLMediaKit/www/ /opt/media/bin/www/
ENV PATH /opt/media/bin:$PATH
CMD ["./MediaServer","-s", "default.pem", "-c", "../conf/config.ini", "-l","0"]