概述
freeswitch是一款简单好用的VOIP开源软交换平台。
rockeylinux8 docker上编译安装fs.1.10的流程记录,本文使用dockerfile模式。
环境
docker engine:Version 24.0.6
rockylinux docker:8
freeswitch:v1.10.7
dockerfile
创建空目录,创建dockerfile文件。
github访问经常失败,先下载好源码包,并将fs.1.10.7源码文件夹拷贝到目录下。
mkdir rockylinux.8-fs.1.10
cd rockylinux.8-fs.1.10
git clone https://github.com/signalwire/freeswitch.git -bv1.10.7 freeswitch-1.10.7
ls
dockerfile freeswitch-1.10.7
dockerfile文件内容如下。
vi dockerfile
FROM rockylinux:8
WORKDIR /root
ADD ./freeswitch-1.10.7 /root/freeswitch
RUN cd /root/ \
&& dnf install 'dnf-command(config-manager)' -y \
&& dnf config-manager --set-enabled powertools \
&& echo "signalwire" > /etc/yum/vars/signalwireusername \
&& echo "TOKEN" > /etc/yum/vars/signalwiretoken \
&& dnf 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 \
&& dnf install -y epel-release -y \
&& dnf makecache \
&& dnf -y update \
&& dnf remove -y spandsp-devel spandsp \
&& dnf install -y sofia-sip-devel spandsp3-devel libks signalwire-client-c erlang postgresql-devel libtool python2-devel gcc-c++ zlib-devel libpng-devel sqlite-devel libcurl-devel pcre-devel speex-devel speexdsp-devel ldns-devel libedit-devel ilbc2-devel opus-devel lua-devel libsndfile-devel \
&& dnf install -y which tzdata yasm git \
&& cd /root/freeswitch/ \
&& chmod 775 -R * \
&& ./bootstrap.sh -j \
&& ./configure \
&& cd /root/freeswitch/src/mod/codecs/mod_g729/ \
&& make \
&& 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 \
&& cd /root/freeswitch/src/mod/applications/mod_distributor \
&& make \
&& make install \
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& dnf -y autoremove \
&& dnf clean all \
&& rm -rf /var/cache/dnf/* \
&& rm -rf /root/freeswitch \
&& rm -rf /usr/share/icons /usr/share/themes/ /usr/share/doc /usr/share/man \
&& 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/rockylinux.8-fs.1.10-release:v1.1.1 .
上传镜像到registry。
sudo docker images
sudo docker push 10.55.55.136:5000/zr/rockylinux.8-fs.1.10-release:v1.1.1
下载镜像。
sudo docker pull 10.55.55.136:5000/zr/rockylinux.8-fs.1.10-release:v1.1.1
启动容器
sudo docker run -itd --net=host -v /home/adminx/docker/rockylinux.8-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 rockylinux.8-fs.1.10-sbc 10.55.55.136:5000/zr/rockylinux.8-fs.1.10-release:v1.1.1 /usr/local/freeswitch/bin/freeswitch -nonat -nosql -nonatmap -nocal -nort
sudo docker logs rockylinux.8-fs.1.10-sbc
sudo docker exec -it rockylinux.8-fs.1.10-sbc /usr/local/freeswitch/bin/fs_cli -x status
sudo docker rm -f rockylinux.8-fs.1.10-sbc
总结
编译出的docker镜像还是比较大,需要持续瘦身。
centos和rocky的方向需要验证和抉择一下。
空空如常
求真得真