fs.1.10 ON CENTOS7 dockerfile模式

概述

freeswitch是一款简单好用的VOIP开源软交换平台。

centos7 docker上编译安装fs.1.10的流程记录,本文使用dockerfile模式。

环境

docker engine:Version 24.0.6

centos docker:7

freeswitch:v1.10.7

dockerfile

创建空目录,创建dockerfile文件。

github访问经常失败,先下载好源码包,并将fs.1.10.7源码文件夹拷贝到目录下。

mkdir centos.7-fs.1.10

cd centos.7-fs.1.10

git clone GitHub - signalwire/freeswitch: FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device. -bv1.10.7 freeswitch-1.10.7

ls

dockerfile freeswitch-1.10.7

保持编译的简易性,该版本不编译mod_av相关的模块,删除mod_av模块目录。

sudo rm -rf freeswitch-1.10.7/src/mod/applications/mod_av

屏蔽configure文件的mod_av模块。

vi freeswitch-1.10.7/configure.ac

删除行,src/mod/applications/mod_av/Makefile

dockerfile文件内容如下。

vi dockerfile

FROM centos:7

WORKDIR /root

ADD ./freeswitch-1.10.7 /root/freeswitch

RUN cd /root/ \

&& yum -y update \

&& yum install -y centos-release-scl centos-release-scl-rh \

&& yum install -y scl-utils scl-utils-build yum-utils \

&& yum install -y devtoolset-9-gcc \

&& echo "signalwireusername" > /etc/yum/vars/signalwireusername \

&& echo "signalwiretoken" > /etc/yum/vars/signalwiretoken \

&& yum install -y https://$(< /etc/yum/vars/signalwireusername):$(< /etc/yum/vars/signalwiretoken)@freeswitch.signalwire.com/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm \

&& yum install -y epel-release \

&& yum install -y yum-utils \

&& yum-builddep -y freeswitch --skip-broken \

&& yum install -y yum-plugin-ovl rpmdevtools yum-utils git centos-release-scl centos-release-scl-rh \

&& yum remove -y spandsp-devel spandsp \

&& yum install -y sofia-sip-devel spandsp3-devel libks signalwire-client-c erlang python-devel postgresql-devel \

&& yum install -y which tzdata ilbc2-devel opus-devel \

&& git clone GitHub - signalwire/freeswitch: FreeSWITCH is a Software Defined Telecom Stack enabling the digital transformation from proprietary telecom switches to a versatile software implementation that runs on any commodity hardware. From a Raspberry PI to a multi-core server, FreeSWITCH can unlock the telecommunications potential of any device. -bv1.10.7 freeswitch \

&& cd /root/freeswitch/ \

&& chmod 775 -R * \

&& ./bootstrap.sh -j \

&& ./configure \

&& cd /root/freeswitch/ \

&& make \

&& make install \

&& cd /root/freeswitch/src/mod/codecs/mod_ilbc \

&& make \

&& make install \

&& cd /root/freeswitch/src/mod/applications/mod_translate \

&& make \

&& make install \

&& ln -s /usr/lib64/ilbc2/libilbc.so.0 /usr/lib64/libilbc.so.0 \

&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \

&& yum clean all \

&& package-cleanup --quiet --leaves | xargs yum remove -y \

&& package-cleanup --quiet --dupes | xargs yum remove -y \

&& rm -rf /var/cache/yum \

&& rm -rf /root/freeswitch \

&& rm -rf /usr/local/freeswitch/conf /usr/local/freeswitch/log /usr/local/freeswitch/recordings

EXPOSE 5080

VOLUME ["/usr/local/freeswitch/conf", "/usr/local/freeswitch/log", "/usr/local/freeswitch/recordings", "/usr/local/freeswitch/sounds", "/usr/local/freeswitch/webapp"]

CMD /usr/local/freeswitch/bin/freeswitch -nonat -nosql -nonatmap -nocal -nort

镜像操作

制作镜像,注意命令最后一个参数是当前目录"."。

sudo docker build --no-cache -t 10.55.55.136:5000/zr/centos.7-fs.1.10-release:v1.1.1 .

[+] Building 1120.5s (9/9) FINISHED docker:default

=> [internal] load build definition from dockerfile 0.1s

=> => transferring dockerfile: 2.75kB 0.0s

=> [internal] load metadata for docker.io/library/centos:7 0.0s

=> [internal] load .dockerignore 0.1s

=> => transferring context: 2B 0.0s

=> [1/4] FROM docker.io/library/centos:7 0.0s

=> [internal] load build context 0.4s

=> => transferring context: 1.16MB 0.3s

=> CACHED [2/4] WORKDIR /ROOT 0.0s

=> [3/4] ADD ./freeswitch-1.10.7 /root/freeswitch 1.3s

=> [4/4] RUN cd /root/ && yum -y update && yum install -y centos-release-scl centos-release-scl-rh && yum install -y scl-utils scl-utils-build yum-utils && yum install -y devtoolset-9-gcc && ec 1106.0s

=> exporting to image 12.0s

=> => exporting layers 12.0s

=> => writing image sha256:008cccf11d97a69d076a32fa8e27a93dd7899f4cf258ea102644f63badd9bfc8 0.0s

=> => naming to 10.55.55.136:5000/zr/centos.7-fs.1.10-release:v1.1.0 0.0s

上传镜像到registry。

sudo docker images

sudo docker push 10.55.55.136:5000/zr/centos.7-fs.1.10-release:v1.1.0

下载镜像。

sudo docker pull 10.55.55.136:5000/zr/centos.7-fs.1.10-release:v1.1.0

启动容器

sudo docker run -itd --net=host -v /home/adminx/docker/centos.7-fs.1.6.19/fs-sbc/conf:/usr/local/freeswitch/conf -v /usr/local/freeswitch/log:/usr/local/freeswitch/log -v /usr/local/freeswitch/recordings:/usr/local/freeswitch/recordings --name centos.7-fs.1.10-sbc 10.55.55.136:5000/zr/centos.7-fs.1.10-release:v1.1.1 /usr/local/freeswitch/bin/freeswitch -nonat -nosql -nonatmap -nocal -nort

sudo docker logs centos.7-fs.1.10-sbc

sudo docker exec -it centos.7-fs.1.10-sbc /usr/local/freeswitch/bin/fs_cli -x status

sudo docker rm -f centos.7-fs.1.10-sbc

总结

编译出的docker镜像还是比较大,需要持续瘦身。

centos系统后续的维护问题需要关注。

centos和rocky的方向需要验证和抉择一下。

空空如常

求真得真

相关推荐
yunfanleo24 分钟前
docker run m3e 配置网络,自动重启,GPU等 配置渠道要点
linux·运维·docker
梅见十柒2 小时前
wsl2中kali linux下的docker使用教程(教程总结)
linux·经验分享·docker·云原生
传而习乎2 小时前
Linux:CentOS 7 解压 7zip 压缩的文件
linux·运维·centos
谭震鸿15 小时前
Zookeeper集群搭建Centos环境下
分布式·zookeeper·centos
意疏15 小时前
【Linux 篇】Docker 的容器之海与镜像之岛:于 Linux 系统内探索容器化的奇妙航行
linux·docker
墨鸦_Cormorant16 小时前
使用docker快速部署Nginx、Redis、MySQL、Tomcat以及制作镜像
redis·nginx·docker
Code_Artist16 小时前
Docker镜像加速解决方案:配置HTTP代理,让Docker学会科学上网!
docker·云原生·容器
wanmei00217 小时前
Dockerfile复制目录进入镜像里
docker
inter_peng17 小时前
[Docker-显示所有容器IP] 显示docker-compose.yml中所有容器IP的方法
tcp/ip·docker·eureka
Linux运维日记17 小时前
k8s1.31版本最新版本集群使用容器镜像仓库Harbor
linux·docker·云原生·容器·kubernetes