ZLMediaKit/docker/centos7/Dockerfile.runtime

131 lines
4.2 KiB
Docker
Raw Permalink Normal View History

2020-12-26 12:48:59 +08:00
ARG Version=7
FROM centos:${Version} As build
ARG HTTP_PROXY=${NO_PROXY}
ARG HTTPS_PROXY=${NO_PROXY}
ARG PKG_CONFIG_VERSION=0.29.2
ARG CMAKE_VERSION=3.18
ARG CMAKE_FULL_VERSION=3.18.4
ARG YASM_VERSION=1.3.0
ARG NASM_VERSION=2.15.05
ARG X265_VERSION=3.4
RUN yum install -y \
gcc \
gcc-c++ \
kernel-devel \
kernel-headers \
openssl \
openssl-devel \
git \
wget \
which
WORKDIR /opt
RUN wget -e "https_proxy=${HTTPS_PROXY}" https://pkgconfig.freedesktop.org/releases/pkg-config-${PKG_CONFIG_VERSION}.tar.gz \
&& tar -zxvf pkg-config-${PKG_CONFIG_VERSION}.tar.gz \
&& cd pkg-config-${PKG_CONFIG_VERSION} \
&& ./configure --with-internal-glib \
&& make -j8 \
&& make install
RUN wget -e "https_proxy=${HTTPS_PROXY}" https://cmake.org/files/v${CMAKE_VERSION}/cmake-${CMAKE_FULL_VERSION}.tar.gz \
&& tar -zxvf cmake-${CMAKE_FULL_VERSION}.tar.gz \
&& cd cmake-${CMAKE_FULL_VERSION} \
&& ./bootstrap \
&& gmake -j8 \
&& gmake install
RUN cd /opt \
&& wget -e "https_proxy=${HTTPS_PROXY}" http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz \
&& tar zxvf yasm-${YASM_VERSION}.tar.gz \
&& cd yasm-${YASM_VERSION} \
&& ./configure \
&& make -j8 \
&& make install
RUN wget -e "https_proxy=${HTTPS_PROXY}" https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-${NASM_VERSION}.tar.xz \
&& tar -xvJf nasm-${NASM_VERSION}.tar.xz \
&& cd nasm-${NASM_VERSION} \
&& ./configure --disable-shared --enable-static \
&& make -j8 \
&& make install
RUN cd /opt \
&& git clone https://code.videolan.org/videolan/x264.git \
&& cd x264 \
&& git checkout -b stable origin/stable \
&& git pull --rebase \
&& ./configure --enable-pic --enable-shared --disable-asm \
&& make -j8 \
&& make install \
&& export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
RUN cd /opt \
&& wget -e "https_proxy=${HTTPS_PROXY}" https://github.com/videolan/x265/archive/Release_${X265_VERSION}.tar.gz \
&& tar zxvf Release_${X265_VERSION}.tar.gz \
&& cd x265-Release_${X265_VERSION}/build/linux \
&& cmake ../../source \
&& make -j8 \
&& make install \
&& export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
RUN cd /opt \
&& git clone https://gitee.com/xia-chu/FFmpeg.git \
&& cd /opt/FFmpeg \
&& export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH \
&& ./configure \
--disable-debug \
--disable-doc \
--disable-shared \
--enable-gpl \
--enable-version3 \
--enable-static \
--enable-nonfree \
--enable-pthreads \
--enable-libx264 \
--enable-libx265 \
--enable-small \
--pkgconfigdir=/usr/local/lib/pkgconfig \
--pkg-config-flags="--static" \
&& make -j8 \
&& make install
RUN cd /opt \
&& git clone --depth 1 https://github.com/xia-chu/ZLMediaKit.git \
&& cd ZLMediaKit \
&& git submodule update --init \
&& mkdir -p build release/linux/Release/ \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& make -j8
RUN mkdir -p /opt/build/opt/zlm/ /opt/build/usr/local/bin/ /opt/build/usr/bin/ /opt/build/usr/local/lib/ /opt/build/etc/localtime \
&& cd /opt/build \
&& /usr/bin/cp -ip /usr/local/lib/libx26* ./usr/local/lib \
&& /usr/bin/cp -ip /usr/local/bin/ffmpeg ./usr/local/bin \
&& /usr/bin/cp -ip /opt/ZLMediaKit/release/linux/Release/MediaServer ./opt/zlm/ \
&& /usr/bin/cp -irp /opt/ZLMediaKit/release/linux/Release/www ./opt/zlm/ \
&& /usr/bin/cp -ip /opt/ZLMediaKit/tests/ssl.p12 ./opt/zlm/ \
&& /usr/bin/cp -ip /usr/bin/which ./usr/bin/
FROM centos:${Version}
LABEL maintainer="chengxiaosheng <kevin__cheng@outlook.com>" project-url="https://github.com/xia-chu/ZLMediaKit" description="一个基于C++11的高性能运营级流媒体服务框架"
EXPOSE 9000/tcp \
1935/tcp \
19350/tcp \
554/tcp \
322/tcp \
80/tcp \
443/tcp \
10000/udp \
10000/tcp
WORKDIR /opt/zlm
VOLUME [ "/opt/zlm/conf/","/opt/zlm/log/","opt/zlm/ffmpeg/"]
COPY --from=build /opt/build /
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH TZ=Asia/Shanghai
Push force replace (#2899) Co-authored-by: Alex <liyu7352@gmail.com> Co-authored-by: xia-chu <771730766@qq.com> Co-authored-by: Johnny <hellojinqiang@gmail.com> Co-authored-by: BackT0TheFuture <10088733+BackT0TheFuture@users.noreply.github.com> Co-authored-by: ljx0305 <ljx0305@gmail.com> Co-authored-by: Per-Arne Andersen <per@sysx.no> Co-authored-by: codeRATny <60806889+codeRATny@users.noreply.github.com> Co-authored-by: 老衲不出家 <tannzh2018@outlook.com> Co-authored-by: Kiki <haijuanchen.sun@gmail.com> Co-authored-by: PioLing <964472638@qq.com> Co-authored-by: dengjfzh <76604422+dengjfzh@users.noreply.github.com> Co-authored-by: a-ucontrol <55526028+a-ucontrol@users.noreply.github.com> Co-authored-by: 百鸣 <94030128+ixingqiao@users.noreply.github.com> Co-authored-by: fruit Juice <2317232721@qq.com> Co-authored-by: Luosh <fjlshyyyy@qq.com> Co-authored-by: tbago <moonzalor@gmail.com> Co-authored-by: Talus <xiaoxiaochenjian@gmail.com> Co-authored-by: 朱如洪 <zhu410289616@163.com> Co-authored-by: pedoc <pedoc@qq.com> Co-authored-by: XiaoYan Lin <linxiaoyan87@foxmail.com> Co-authored-by: xiangshengjye <46069012+xiangshengjye@users.noreply.github.com> Co-authored-by: tjpgt <602950305@qq.com> Co-authored-by: Nick <joyouswind@gmail.com> Co-authored-by: yogo-zhangyingzhe <100331270+yogo-zhangyingzhe@users.noreply.github.com> Co-authored-by: Xiaofeng Wang <wasphin@gmail.com> Co-authored-by: Dw9 <xweimvp@gmail.com> Co-authored-by: waken <33921191+mc373906408@users.noreply.github.com> Co-authored-by: Deepslient <1154547394@qq.com>
2023-10-12 17:09:20 +08:00
CMD ["./MediaServer", "-c" , "./conf/config.ini"]