webrtc 镜像制作

制作镜像git仓库参考链接
https://maojie.github.io/2019/03/26/webrtc_tutorial/

https://blog.csdn.net/luansxx/article/details/89597525

步骤:
1、安装docker,并配置镜像加速,参考https://www.runoob.com/docker/docker-mirror-acceleration.html

2、拉取ubuntu 18.04 docker镜像,参考https://hub.docker.com/_/ubuntu?tab=tags

3、进入ubuntu docker镜像

4、执行mv /etc/apt/sources.list /etc/apt/sources.list.bak

5、更换下面的apt源,然后执行apt update

echo "deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse">>/etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse">>/etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse">>/etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse">>/etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse">>/etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse">>/etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse">>/etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse">>/etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse">>/etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse">>/etc/apt/sources.list

6、安装vim、ssh服务,apt install vim;apt-get install openssh-server并设置允许root 登录vim /etc/ssh/sshd_config 找到PermitRootLogin without-password 修改为PermitRootLogin yes,并启用sshd服务 /etc/init.d/ssh start,记得更改一下docker容器root密码(宿主机ssh/git访问docker,记得需要docker容器启动映射22端口,并使用宿主机上显示的vEthernet网络的ip)找到PermitRootLogin without-password修改为PermitRootLogin yes

7、安装git 、wget和python,apt install git; apt install wget; apt install python

8、配置代理,需翻墙,根据局域网ip和翻墙软件http代理端口配置

git config --global http.proxy http://you_proxy_ip:you_proxy_port
git config --global https.proxy https://you_proxy_ip:you_proxy_port

9、进入root目录,创建webrtc目录,cd root; mkdir webrtc
执行git clone https://chromium.googlesource.com/chromium/tools/depot_tools
(需要再墙外)
或者使用git clone https://source.codeaurora.org/quic/lc/chromium/tools/depot_tools
(参考https://www.cnblogs.com/yemaomao/p/12461055.html

10、在~/.bashrc 中添加export PATH=/root/webrtc/depot_tools:$PATH
保存后执行source ~/.bashrc

11、执行mkdir webrtc-cache ;mkdir webrtc; cd webrtc

12、创建.gclient文件

solutions = [
  { "name" : "src",
    "url": "https://chromium.googlesource.com/chromium/src.git",
    "deps_file" : "DEPS",
    "managed"  : True,
    "custom_deps" : {
    },
    "safesync_url": "",
  },
]
cache_dir = "/root/webrtc-cache"
target_os = [
  "linux",
  "win",
  "mac",
  "ios",
  "android"
]

13、根据提示解决问题(如:手动下载 .cipd_client、配置wget代理)

export http_proxy=http://you_proxy_ip:you_proxy_port
export https_proxy=https://you_proxy_ip:you_proxy_port

14、执行gclient sync --nohook --with_tags --ignore_lock,出错重新执行该语句直到正常结束无报错

15、此时 depot_tools、webrtc源码src文件夹、webrtc-cache依赖项目的git仓库均拉取完毕

16、准备使用Gitolite搭建webrtc镜像的依赖项目的仓库,以下过程参考文章开始处推荐的第一篇,请阅读后继续

17、在某台工作主机上,生成ssh公钥和私钥ssh-keygen -t rsa -f gitolite,你将得到两个文件gitolite 和 gitolite.pub,将gitolite.pub拷贝到docker服务器上的~/.ssh/文件夹下,安装gitolite

$ apt-get install gitolite3

建立gitolite3管理仓库,执行gitolite setup -pk gitolite.pub,会得到两个仓库

/your-user-home-dir/repositories/gitolite-admin.git
/your-user-home-dir/repositories/testing.git

在工作机上配置ssh登录验证

$ vi ~/.ssh/config # Add the following content
host [your-docker-reflex-veth-ip]
  HostName [your-docker-name]
  IdentityFile ~/.ssh/gitolite
  User [your-docker-username]
Port [your-docker-ssh-reflex-export-port]

并拉取gitolite仓库的配置仓库,下面命令中:"x.x.x.x"代表your-docker-reflex-veth-ip,"port"是your-docker-ssh-reflex-export-port (docker容器导出的映射内部sshd服务22端口的外部端口)

$ git clone ssh://[username]@[x.x.x.x]:[port]/gitolite-admin.git
# or  "git clone [username]@[x.x.x.x]/gitolite-admin.git  " if you assign the 'Port' in ~/.ssh/config
# gitolite-admin has two directories
gitolite-admin/conf/gitolite.conf to manage the remote repositories
gitolite-admin/keydir/ to manage the public keys

在docker镜像上建立webrtc third_party库的映射,执行以下命令

mkdir -p /root/repositories/platform/external
mkdir -p /root/repositories/breakpad
mkdir -p /root/repositories/chromium/deps
mkdir -p /root/repositories/chromium/deps/yasm
mkdir -p /root/repositories/chromium/llvm-project/cfe/tools
mkdir -p /root/repositories/chromium/llvm-project/compiler-rt/lib
mkdir -p /root/repositories/chromium/src
mkdir -p /root/repositories/chromium/src/third_party
mkdir -p /root/repositories/chromium/tools
mkdir -p /root/repositories/external/github.com/cisco
mkdir -p /root/repositories/external/github.com/google
mkdir -p /root/repositories/external/github.com/gradle
mkdir -p /root/repositories/external/github.com/harfbuzz
mkdir -p /root/repositories/external/github.com/kennethreitz
mkdir -p /root/repositories/external/github.com/llvm/llvm-project
mkdir -p /root/repositories/external/github.com/open-source-parsers
mkdir -p /root/repositories/external/github.com/sctplab
mkdir -p /root/repositories/external/mockito
mkdir -p /root/repositories/infra/luci
mkdir -p /root/repositories/libyuv
mkdir -p /root/repositories/webm
ln -s /root/webrtc/webrtc-cache/android.googlesource.com-platform-external-perfetto  /root/repositories/platform/external/perfetto.git
ln -s /root/webrtc/webrtc-cache/aomedia.googlesource.com-aom /root/repositories/aom.git
ln -s /root/webrtc/webrtc-cache/boringssl.googlesource.com-boringssl /root/repositories/boringssl.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-android_ndk /root/repositories/android_ndk.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-breakpad-breakpad /root/repositories/breakpad/breakpad.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-catapult /root/repositories/catapult.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-deps-findbugs /root/repositories/chromium/deps/findbugs.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-deps-icu /root/repositories/chromium/deps/icu.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-deps-libjpeg_turbo /root/repositories/chromium/deps/libjpeg_turbo.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-deps-libsrtp /root/repositories/chromium/deps/libsrtp.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-deps-nasm /root/repositories/chromium/deps/nasm.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-deps-yasm-binaries /root/repositories/chromium/deps/yasm/binaries.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-llvm--project-cfe-tools-clang--format /root/repositories/chromium/llvm-project/cfe/tools/clang-format.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-llvm--project-compiler--rt-lib-fuzzer /root/repositories/chromium/llvm-project/compiler-rt/lib/fuzzer.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-base /root/repositories/chromium/src/base.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-build /root/repositories/chromium/src/build.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-buildtools /root/repositories/chromium/src/buildtools.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-ios /root/repositories/chromium/src/ios.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-testing /root/repositories/chromium/src/testing.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-third_party /root/repositories/chromium/src/third_party.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-third_party-freetype2 /root/repositories/chromium/src/third_party/freetype2.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-third_party-libunwindstack /root/repositories/chromium/src/third_party/libunwindstack.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-src-tools /root/repositories/chromium/src/tools.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-third_party-ffmpeg /root/repositories/chromium/third_party/ffmpeg.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-third_party-ub--uiautomator /root/repositories/chromium/third_party/ub-uiautomator.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-chromium-tools-depot_tools /root/repositories/chromium/tools/depot_tools.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-colorama /root/repositories/external/colorama.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-fontconfig /root/repositories/external/fontconfig.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-cisco-openh264 /root/repositories/external/github.com/cisco/openh264.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-google-benchmark /root/repositories/external/github.com/google/benchmark.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-google-compact_enc_det /root/repositories/external/github.com/google/compact_enc_det.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-google-googletest /root/repositories/external/github.com/google/googletest.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-google-gtest--parallel /root/repositories/external/github.com/google/gtest-parallel.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-google-turbine /root/repositories/external/github.com/google/turbine.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-gradle-gradle /root/repositories/external/github.com/gradle/gradle.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-harfbuzz-harfbuzz /root/repositories/external/github.com/harfbuzz/harfbuzz.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-kennethreitz-requests /root/repositories/external/github.com/kennethreitz/requests.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-llvm-llvm--project-libcxx /root/repositories/external/github.com/llvm/llvm-project/libcxx.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-llvm-llvm--project-libcxxabi /root/repositories/external/github.com/llvm/llvm-project/libcxxabi.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-llvm-llvm--project-libunwind /root/repositories/external/github.com/llvm/llvm-project/libunwind.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-open--source--parsers-jsoncpp /root/repositories/external/github.com/open-source-parsers/jsoncpp.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-github.com-sctplab-usrsctp /root/repositories/external/github.com/sctplab/usrsctp.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-junit /root/repositories/external/junit.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-external-mockito-mockito /root/repositories/external/mockito/mockito.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-infra-luci-client--py /root/repositories/infra/luci/client-py.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-libyuv-libyuv /root/repositories/libyuv/libyuv.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-linux--syscall--support /root/repositories/linux-syscall-support.git
ln -s /root/webrtc/webrtc-cache/chromium.googlesource.com-webm-libvpx /root/repositories/webm/libvpx.git
n -s /root/webrtc/webrtc/src/.git /root/repositories/src.git
ln -s /root/webrtc/depot_tools/.git /root/repositories/depot_tools.git

在工作主机刚刚拉取下来的gitolite的仓库配置文件中,添加与上述.git对应的所有的third_party库配置

$ vim gitolite-admin/conf/gitolite.conf
#add these config
repo platform/external/perfetto
    RW+     =   @all
    
repo aom
    RW+     =   @all

repo boringssl
    RW+     =   @all

repo android_ndk
    RW+     =   @all

repo breakpad/breakpad
    RW+     =   @all
    

repo catapult
    RW+     =   @all
    
repo chromium/deps/findbugs
    RW+     =   @all

repo chromium/deps/icu
    RW+     =   @all

repo chromium/deps/libjpeg_turbo
    RW+     =   @all

repo chromium/deps/libsrtp
    RW+     =   @all

repo chromium/deps/nasm
    RW+     =   @all
    
repo chromium/deps/yasm/binaries
    RW+     =   @all

repo chromium/llvm-project/cfe/tools/clang-format
    RW+     =   @all

repo chromium/llvm-project/compiler-rt/lib/fuzzer
    RW+     =   @all

repo chromium/src/base
    RW+     =   @all
    

repo chromium/src/build
    RW+     =   @all
    
repo chromium/src/buildtools
    RW+     =   @all

repo chromium/src/ios
    RW+     =   @all

repo chromium/src/testing
    RW+     =   @all

repo chromium/src/third_party
    RW+     =   @all
    
    
repo chromium/src/third_party/freetype2
    RW+     =   @all
    
repo chromium/src/third_party/libunwindstack
    RW+     =   @all

repo chromium/src/tools
    RW+     =   @all

repo chromium/third_party/ffmpeg
    RW+     =   @all

repo chromium/third_party/ub-uiautomator
    RW+     =   @all
    

repo chromium/tools/depot_tools
    RW+     =   @all
    
repo external/colorama
    RW+     =   @all

repo external/fontconfig
    RW+     =   @all

repo external/github.com/cisco/openh264
    RW+     =   @all

repo external/github.com/google/benchmark
    RW+     =   @all

repo external/github.com/google/compact_enc_det
    RW+     =   @all

repo external/github.com/google/googletest
    RW+     =   @all

repo external/github.com/google/gtest-parallel
    RW+     =   @all

repo external/github.com/google/turbine
    RW+     =   @all

repo external/github.com/gradle/gradle
    RW+     =   @all

repo external/github.com/harfbuzz/harfbuzz
    RW+     =   @all

repo external/github.com/kennethreitz/requests
    RW+     =   @all

repo external/github.com/llvm/llvm-project/libcxx
    RW+     =   @all

repo external/github.com/llvm/llvm--project/libcxxabi
    RW+     =   @all

repo external/github.com/llvm/llvm--project/libunwind
    RW+     =   @all

repo external/github.com/open--source--parsers/jsoncpp
    RW+     =   @all

repo external/github.com/sctplab/usrsctp
    RW+     =   @all

repo external/junit
    RW+     =   @all
    
repo external/mockito/mockito
    RW+     =   @all

repo infra/luci/client--py
    RW+     =   @all
    
repo libyuv/libyuv
    RW+     =   @all

repo linux--syscall--support
    RW+     =   @all

repo webm/libvpx
    RW+     =   @all

repo src
    RW+     =   @all

repo depot_tools
    RW+     =   @all

在工作主机上把更新的gitolite的仓库配置上传到docker镜像上去

$ cd gitolite-admin
$ git add conf/gitolite.conf
$ git commit -m "Expose all the related repos"
$ git push origin master

如果更新用户后,用户无法正确拉取库,则登录docker镜像执行以下

$ gitolite compile

18、再工作主机某目录执行下列操作,拉取depot_tools和webrtc源码。下述命令中:"x.x.x.x"代表your-docker-reflex-veth-ip,"port"是your-docker-ssh-reflex-export-port (docker容器导出的映射内部sshd服务22端口的外部端口)

$ git clone ssh://[username]@[x.x.x.x]:[port]/depot_tools.git
$ mkdir webrtc
$ cd webrtc
$ git clone ssh://[username]@[x.x.x.x]:[port]/src.git

19、在webrtc源码“src"文件夹所在目录,新建.gclient文件内容为

solutions = [
  {
    "url": "ssh://[username]@[x.x.x.x]:[port]/src.git",
    "managed": False,
    "name": "src",
    "deps_file": "DEPS",
    "custom_deps": {},
  },
]

20、再查看src/DEPS文件,进行如下替换
Replace 'https://chromium.googlesource.com' to 'ssh://[username]@[x.x.x.x]:[port]'
Replace 'https://boringssl.googlesource.com' to 'ssh://[username]@[x.x.x.x]:[port]'
Replace 'https://aomedia.googlesource.com' to 'ssh://[username]@[x.x.x.x]:[port]'
Replace 'https://android.googlesource.com' to 'ssh://[username]@[x.x.x.x]:[port]'

21、将depot_tools目录导出到PATH,

export PATH=/root/webrtc/depot_tools:$PATH

在src目录执行

gclient sync --nohooks --verbose

注:上述步骤做完,只是在docker建立了webrtc源码镜像和third_party源码镜像,但是webrtc构建还需要依赖多个cipd库的资源,这些资源由glcient sync命令获取,由于防火墙\google等的限制不易获取。因此可以拷贝一份docker镜像中拉取完整的webrtc的源码src目录,剔除src下的所有.git,并把.gitignore中cipd相关的忽略项删除(cipd项见src下的DEPS文件,搜索cipd),剔除后对该副本src建立git远程仓库,则所有third_party以及拉取完成的cipd依赖会全部在该远程仓库中。开发、维护可以在该远程仓库下进行。此外,在所有的开发环境中,需要把depot_tools建立好,可以拷贝其他用户环境下现成的depot_tools并设置环境变量DEPOT_TOOLS_UPDATE=0禁止depot_tools自动更新,或者安装前面的步骤去执行client sync更新depot_tools。

22、webrtc编译
(1)在src目录下执行,gn args out/Default会打开在src/out/Default下的args.gn文件用于配置gn编译标志。
(2)执行gn args out/Default --list会展示所有可配置标志

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 157,198评论 4 359
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 66,663评论 1 290
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 106,985评论 0 237
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,673评论 0 202
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 51,994评论 3 285
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,399评论 1 211
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,717评论 2 310
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,407评论 0 194
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,112评论 1 239
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,371评论 2 241
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,891评论 1 256
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,255评论 2 250
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,881评论 3 233
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,010评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,764评论 0 192
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,412评论 2 269
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,299评论 2 260

推荐阅读更多精彩内容