janus centos docker 部署
Posted 奔腾的时间
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 && \\
3 yum provides '*/applydeltarpm'&& \\
4 yum install deltarpm -y && \\
5 yum update -y && \\
6 yum install wget git -y && \\
7 cd etc/yum.repos.d && \\
8 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo && \\
9 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo && \\
10 yum clean all && \\
11 yum makecache && \\
12 yum list | grep epel-release.noarch && \\
13 yum install epel-release.noarch -y && \\
14 wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo && \\
15 yum clean all && \\
16 yum makecache && \\
17 yum install -y jansson-devel libwebsockets-devel.x86_64 \\
18 openssl-devel libsrtp-devel glib2-devel libsrtp-devel.x86_64 \\
19 opus-devel libogg-devel libcurl-devel pkgconfig gengetopt \\
20 libconfig-devel libtool autoconf automake cmake make meson librabbitmq-devel.x86_64 \\
21 gnutls-devel.x86_64 texinfo gtk-doc.x86_64 && \\
22 yum install epel-release -y && \\
23 yum update -y && \\
24 yum install -y https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm && \\
25 yum install -y ffmpeg-devel.x86_64 && \\
26 yum clean all && rm -rf /var/cache/yum/*
27 #context: .
28 WORKDIR /usr/local/src
29 #源码安装需要的库
30 RUN wget https://github.com/cisco/libsrtp/archive/v2.0.0.tar.gz && \\
31 tar xfv v2.0.0.tar.gz && \\
32 cd libsrtp-2.0.0 && \\
33 ./configure --prefix=/usr --enable-openssl && \\
34 make shared_library && \\
35 make install && rm -rf /usr/local/src/*
36 RUN wget ftp://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.72.tar.gz && \\
37 tar xfv libmicrohttpd-0.9.72.tar.gz && \\
38 cd libmicrohttpd-0.9.72 && \\
39 ./configure && \\
40 make && \\
41 make install && rm -rf /usr/local/src/*
42 RUN git clone https://github.com/libnice/libnice.git && \\
43 cd libnice && \\
44 meson --prefix=/usr build && \\
45 ninja -C build && \\
46 ninja -C build install && rm -rf /usr/local/src/*
47 RUN git clone --branch 0.9.5.0 https://github.com/sctplab/usrsctp.git && \\
48 cd usrsctp && \\
49 ./bootstrap && \\
50 ./configure --prefix=/usr && \\
51 make && \\
52 make 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 && \\
56 tar xfv sofia-sip.tar.gz && \\
57 cd sofia-sip && \\
58 ./bootstrap.sh && \\
59 ./configure && \\
60 make && make install && rm -rf /usr/local/src/* && \\
61 ldconfig && \\
62 cd /usr/local/src && \\
63 rm -rf ./* && \\
64 yum clean all && \\
65 rm -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 && \\
68 tar xfz turnserver-4.5.0.7.tar.gz && \\
69 cd turnserver-4.5.0.7 && \\
70 ./configure && \\
71 make && \\
72 make 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 && \\
76 cd janus-gateway && \\
77 ./autogen.sh && \\
78 export PKG_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 && \\
80 make && \\
81 make install && \\
82 make configs && \\
83 make 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:
3 janus:
4 image: amdoxxx
5 container_name: amdox925
6 #restart: always
7 network_mode: "host"
8 stdin_open: true
9 tty: true
10 build: .
11 command:
12 - /bin/sh
13 - -c
14 - |
15 cd /usr/local/bin/
16 nohup 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
18 cd /usr/local/janus/bin
19 ./janus
20 tail -f /dev/null
21 ports:
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"
32 volumes:
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"
36 stdin_open: true
37 tty: true
3)对 janus 进行配置,参考我的另外一篇博客 《unbutu 18.04 下 Janus 安装》 ,
unbutu 18.04 下 Janus 安装_abc1231987的专栏-CSDN博客
4)最后部署成功,示例效果图如下:
以上是关于janus centos docker 部署的主要内容,如果未能解决你的问题,请参考以下文章