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 https://github.com/signalwire/freeswitch.git -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 https://github.com/signalwire/freeswitch.git -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的方向需要验证和抉择一下。

 

空空如常

求真得真

posted @ 2024-04-11 18:11  求真得真  阅读(23)  评论(0编辑  收藏  举报