knowledge/docs/freeswitch/docker.md

3.3 KiB

制作FreeSWITCH镜像的Dockerfile

wandoubaba / 2024-08-19

下面是基于debian:bookworm镜像制作FreeSWITCH1.10.12版服务镜像,同时安装mod_unimrcp模块并开启mod_shout模块。

FROM debian:bookworm

RUN apt-get update && apt-get upgrade -y && \
    apt-get install -y wget tar git \
    build-essential cmake automake autoconf 'libtool-bin|libtool' pkg-config \
    libssl-dev zlib1g-dev libdb-dev \
    unixodbc-dev libncurses5-dev \
    libexpat1-dev libgdbm-dev bison erlang-dev \
    libtpl-dev libtiff5-dev uuid-dev \
    libpcre3-dev libedit-dev libsqlite3-dev \
    libcurl4-openssl-dev nasm \
    libogg-dev libspeex-dev libspeexdsp-dev \
    libldns-dev \
    python3-dev \
    libavformat-dev libswscale-dev 'libswresample-dev|libavresample-dev' \
    liblua5.3-dev \
    libopus-dev \
    libpq-dev \
    libsndfile1-dev libflac-dev libogg-dev libvorbis-dev \
    libshout3-dev libmpg123-dev libmp3lame-dev \
    lsb-release

RUN mkdir /install && cd /install && \
    git clone -b v1.10 https://github.com/signalwire/freeswitch freeswitch && \
    git clone https://github.com/signalwire/libks && \
    git clone https://github.com/freeswitch/sofia-sip && \
    git clone -b fs https://github.com/freeswitch/spandsp && \
    git clone https://github.com/signalwire/signalwire-c && \
    git clone https://github.com/unispeech/unimrcp.git && \
    git clone https://github.com/freeswitch/mod_unimrcp.git && \
    wget https://www.unimrcp.org/project/component-view/unimrcp-deps-1-6-0-tar-gz/download -O unimrcp-deps-1.6.0.tar.gz && \
    tar xvzf unimrcp-deps-1.6.0.tar.gz

RUN cd /install/libks && \
    cmake . -DCMAKE_INSTALL_PREFIX=/usr -DWITH_LIBBACKTRACE=1 && \
    make install

RUN cd /install/sofia-sip && \
    ./bootstrap.sh && \
    ./configure CFLAGS="-g -ggdb" --with-pic --with-glib=no --without-doxygen --disable-stun --prefix=/usr && \
    make -j`nproc --all` && \
    make install

RUN cd /install/spandsp && \
    ./bootstrap.sh && \
    ./configure CFLAGS="-g -ggdb" --with-pic --prefix=/usr && \
    make -j`nproc --all` && \
    make install

RUN cd /install/signalwire-c && \
    PKG_CONFIG_PATH=/usr/lib/pkgconfig cmake . -DCMAKE_INSTALL_PREFIX=/usr && \
    make install
    
RUN cd /install/freeswitch && \
    sed -i 's|#formats/mod_shout|formats/mod_shout|' build/modules.conf.in && \
    ./bootstrap.sh -j && \
    ./configure && \
    make -j`nproc` && \
    make install && \
    make cd-sounds-install && \
    make cd-moh-install && \
    make uhd-sounds-install && \
    make uhd-moh-install && \
    make hd-sounds-install && \
    make hd-moh-install && \
    make sounds-install && \
    make moh-install && \
    ln -sf /usr/local/freeswitch/bin/freeswitch /usr/local/bin/ && \
    ln -sf /usr/local/freeswitch/bin/fs_cli /usr/local/bin/

RUN cd /install/unimrcp-deps-1.6.0/libs/apr && \
    ./configure --prefix=/usr/local/apr && \
    make && make install && \
    cd ../apr-util && \
    ./configure --prefix=/usr/local/apr --with-apr=/usr/local/apr && \
    make && make install && \
    cd ../../../unimrcp && \
    ./bootstrap && \
    ./configure --with-sofia-sip=/usr && \
    make && make install && \
    cd ../mod_unimrcp && \
    export PKG_CONFIG_PATH=/usr/local/freeswitch/lib/pkgconfig:/usr/local/unimrcp/lib/pkgconfig && \
    ./bootstrap.sh && \
    ./configure && \
    make && make install

RUN apt-get clean