文档说明:只记录关键地方;
试验环境: linux debian 11
目标:构建能启动的 coturn

coturn 服务器完整的实现了 STUN/TURN/ICE 协议

基础环境: docker

构建脚本 build-docker.sh

#!/bin/bash

set -e
export DOCKER_BUILDKIT=1
# shellcheck disable=SC2006
TIME=`date "+%Y%m%d"`
VERSION="dev-"${TIME}
IMAGE="registry.cn-beijing.aliyuncs.com/jingjingxyk-public/app:coturn-dev-${VERSION}"

PROXY_URL=${2:+'http://192.168.3.26:8015'}
 
# 要使用代理,需要传递两个参数
# sh build-docker.sh --proxy 1

docker build -t "$IMAGE" -f Dockerfile . --progress=plain
docker push "$IMAGE"

FROM debian:buster
# 启动非交互模式:
ENV DEBIAN_FRONTEND=noninteractive
# https://github.com/coturn/coturn/blob/master/INSTALL
# https://github.com/coturn/coturn/blob/master/docker/coturn/Dockerfile

RUN  test ! -f /etc/apt/source.list.save && cp  /etc/apt/sources.list /etc/apt/sources.list.save
RUN  sed -i "s@security.ubuntu.com@mirrors.ustc.edu.cn@g" /etc/apt/sources.list 
RUN  sed -i "s@archive.ubuntu.com@mirrors.ustc.edu.cn@g" /etc/apt/sources.list

RUN  apt update -y
RUN apt install -y sudo
RUN sudo apt install -y \
ca-certificates \
git wget curl \
gcc \
openssl libssl-dev \
sqlite \
libsqlite-dev \
libevent-dev \
libpq-dev \
libmariadbd-dev libmariadb-dev \
libevent-dev

# https://github.com/mongodb/mongo-c-driver/
RUN sudo apt install -y \
 libbson-dev  libmongoc-dev \
libhiredis-dev
RUN sudo apt install -y -y make cmake g++ gdebi-core
RUN sudo apt install -y initscripts net-tools pkg-config sqlite3 libsqlite3-dev

ENV BUILD_PREFIX /usr/local/src
ENV INSTALL_PREFIX /usr/local
WORKDIR $BUILD_PREFIX

ARG  PROXY_URL
ENV  http_proxy=$PROXY_URL
ENV  https_proxy=$PROXY_URL

RUN git clone https://github.com/coturn/coturn.git

ENV  http_proxy=''
ENV  https_proxy=''

#ADD ./coturn /coturn
# Build Coturn
WORKDIR ${BUILD_PREFIX}/coturn
RUN ./configure -h
RUN make
RUN make install


# set startup parameters
# SUTN/TURN PORTS
EXPOSE 3478 3479 3478/udp 3479/udp 80 80/udp
EXPOSE 5349 5350 5349/udp 5350/udp 443 443/udp
# CLI
EXPOSE 5766
# Relay Ports
EXPOSE 49152-65535 49152-65535/udp

#COPY ./docker-entrypoint.sh /
#ENTRYPOINT ["/docker-entrypoint.sh"]
RUN cp /usr/local/etc/turnserver.conf.default  /usr/local/etc/turnserver.conf
WORKDIR ${INSTALL_PREFIX}

# ENTRYPOINT ["tini", "--","/usr/local/bin/turnserver"]

CMD ${INSTALL_PREFIX}/bin/turnserver

# cat /usr/local/share/doc/turnserver/postinstall.txt
# install examples/etc/turnserver.conf /usr/local/etc/turnserver.conf.default
# install turndb/schema.sql /usr/local/share/doc/turnserver


参考文档

  1. coturn INSTALL
  2. coturn Dockerfile
  3. WebRTC samples
  4. WebRTC source code
  5. github coturn
  6. shell之变量默认值
  7. Dockerfile

原文地址:http://www.cnblogs.com/jingjingxyk/p/16826986.html

1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长! 2. 分享目的仅供大家学习和交流,请务用于商业用途! 3. 如果你也有好源码或者教程,可以到用户中心发布,分享有积分奖励和额外收入! 4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解! 5. 如有链接无法下载、失效或广告,请联系管理员处理! 6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需! 7. 如遇到加密压缩包,默认解压密码为"gltf",如遇到无法解压的请联系管理员! 8. 因为资源和程序源码均为可复制品,所以不支持任何理由的退款兑现,请斟酌后支付下载 声明:如果标题没有注明"已测试"或者"测试可用"等字样的资源源码均未经过站长测试.特别注意没有标注的源码不保证任何可用性