Janus|janus centos docker 部署

环境:centos7
1)Dockfile 文件如下, 执行docker build -t amdoxxx . ,生成docker 镜像amdoxxx。
1 FROM centos:7
2 RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 && \
3yum provides '*/applydeltarpm'&& \
4yum install deltarpm -y && \
5yum update -y && \
6yum install wget git -y &&\
7cd etc/yum.repos.d&& \
8wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo&& \
9wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo&& \
10yum clean all&& \
11yum makecache&& \
12yum list | grep epel-release.noarch && \
13yum install epel-release.noarch-y && \
14wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo&& \
15yum clean all&& \
16yum makecache&& \
17yum install -yjansson-devel libwebsockets-devel.x86_64 \
18openssl-devel libsrtp-develglib2-devel libsrtp-devel.x86_64 \
19opus-devel libogg-devel libcurl-devel pkgconfig gengetopt\
20libconfig-devel libtool autoconf automake cmake make meson librabbitmq-devel.x86_64 \
21gnutls-devel.x86_64 texinfo gtk-doc.x86_64 && \
22yum install epel-release -y && \
23yum update -y && \
24yum install -y https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm && \
25yum install -y ffmpeg-devel.x86_64 && \
26yum clean all && rm -rf /var/cache/yum/*
27 #context: .
28 WORKDIR /usr/local/src
29 #源码安装需要的库
30 RUNwget https://github.com/cisco/libsrtp/archive/v2.0.0.tar.gz && \
31tar xfv v2.0.0.tar.gz && \
32cd libsrtp-2.0.0 && \
33./configure --prefix=/usr --enable-openssl && \
34make shared_library && \
35make install && rm -rf /usr/local/src/*
36 RUN wget ftp://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.72.tar.gz && \
37tar xfv libmicrohttpd-0.9.72.tar.gz && \
38cd libmicrohttpd-0.9.72 && \
39./configure && \
40make && \
41make install &&rm -rf /usr/local/src/*
42 RUN git clonehttps://github.com/libnice/libnice.git && \
43cd libnice && \
44meson --prefix=/usr build && \
45ninja -C build && \
46ninja -C build install&& rm -rf /usr/local/src/*
47 RUN git clone --branch 0.9.5.0 https://github.com/sctplab/usrsctp.git&& \
48cd usrsctp && \
49./bootstrap && \
50./configure --prefix=/usr && \
51make && \
52make install
53 #RUN git clone https://github.com/freeswitch/sofia-sip.git&& \
54 COPY sofia-sip.tar.gz /usr/local/src
55 RUN cd /usr/local/src && \
56tar xfv sofia-sip.tar.gz && \
57cd sofia-sip&& \
58./bootstrap.sh&& \
59./configure&& \
60make && make install && rm -rf /usr/local/src/* && \
61ldconfig && \
62cd /usr/local/src && \
63rm -rf ./* && \
64yum clean all && \
65rm -rf /var/cache/yum/*&& rm -rf /usr/local/src/*
66 RUN yum -y install libevent-devel
67 RUN wget http://coturn.net/turnserver/v4.5.0.7/turnserver-4.5.0.7.tar.gz && \
68tar xfz turnserver-4.5.0.7.tar.gz && \
69cd turnserver-4.5.0.7 && \
70./configure && \
71make && \
72make install &&rm -rf /usr/local/src/*
73 #nohup turnserver -L 0.0.0.0 --min-port 30000 --max-port 60000 -a -u root:123456 -v -f -r nort.gov &
74 RUN yum -y install nginx
75 RUN git clone --branch v0.11.2 https://github.com/meetecho/janus-gateway.git && \
76cd janus-gateway && \
77./autogen.sh && \
78exportPKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH && \
79./configure --prefix=/usr/local/janus--enable-json-logger--enable-libsrtp2--enable-post-processing--enable-rest--enable-websockets&& \
80make&& \
81make install&& \
82make configs && \
83make clean && rm -rf /usr/local/src/*
84 COPY certs /usr/local/src/certs
85 EXPOSE 10000-10200/udp
86 EXPOSE 8188
87 EXPOSE 8088
88 EXPOSE 8089
89 EXPOSE 8889
90 EXPOSE 8000
91 EXPOSE 7088
92 EXPOSE 7089
93 EXPOSE 8989
94 EXPOSE 3478
95 EXPOSE 80
96 EXPOSE 443
2)Dockfile文件如下(nginx 可以配置在宿主机器上,也可以配置在容器里面,我这里只写配置在容器里的方法),执行docker-compose up 命令:
1 version: "3"
2 services:
3janus:
4image: amdoxxx
5container_name: amdox925
6#restart: always
7network_mode: "host"
8stdin_open: true
9tty: true
10build: .
11command:
12- /bin/sh
13- -c
14- |
15cd /usr/local/bin/
16nohup turnserver -L 0.0.0.0 --min-port 30000 --max-port 60000 -a -u root:123456 -v -f -r nort.gov &
17/usr/sbin/nginx
18cd /usr/local/janus/bin
19./janus
20tail -f /dev/null
21ports:
22- "8188:8188"
23- "8088:8088"
24- "8089:8089"
25- "8889:8889"
26- "8000:8000"
27- "7088:7088"
28- "7089:7089"
29- "8989:8989"
30- "3478:3478"
31- "3478:3478/udp"
32volumes:
33- "/usr/local/janus/share/janus/demos:/usr/local/janus/share/janus/demos"
34- "/usr/local/janus/etc/janus:/usr/local/janus/etc/janus"
35- "/etc/nginx/nginx.conf:/etc/nginx/nginx.conf"
36stdin_open: true
37tty: true
3)对 janus 进行配置,参考我的另外一篇博客 《unbutu 18.04 下 Janus 安装》 ,
unbutu 18.04 下 Janus 安装_abc1231987的专栏-CSDN博客
4)最后部署成功,示例效果图如下:
Janus|janus centos docker 部署
文章图片

【Janus|janus centos docker 部署】

    推荐阅读