-
-
Save ruipfmendes/59684e9ef9da7c0d4192ed6ae1de6354 to your computer and use it in GitHub Desktop.
FreeSWITCH v1.10.5 build Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Build FreeSWITCH with mod_dialogflow and GRPC libraries | |
WORKDIR /usr/src/ | |
USER root | |
ENV CFG_DIR /etc/freeswitch | |
RUN mkdir -p freeswitch-files | |
ADD patches/* freeswitch-files/ | |
RUN apt-get update && apt-get -y --quiet --allow-remove-essential upgrade \ | |
&& apt-get install -y --quiet --no-install-recommends gnupg2 wget curl git cmake automake autoconf libtool libtool-bin build-essential pkg-config ca-certificates \ | |
libavformat-dev liblua5.1-0 liblua5.1-0-dev libssl-dev libz-dev libjpeg-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libpcre3-dev libswscale-dev \ | |
libspeex-dev libspeexdsp-dev libedit-dev libtiff-dev yasm haveged libldns-dev unixodbc \ | |
libopus-dev libopusfile-dev libsndfile-dev libshout3 libshout3-dev libmpg123-dev libmp3lame-dev libedit2 libfreetype6 libsndfile1 libsofia-sip-ua-dev libspandsp-dev \ | |
&& apt-get update \ | |
&& cd /usr/src \ | |
&& git config --global pull.rebase true \ | |
&& git clone https://github.com/signalwire/freeswitch.git -b v1.10.5 \ | |
&& git clone https://github.com/drachtio/drachtio-freeswitch-modules.git -b v0.4.0 \ | |
&& git clone https://github.com/grpc/grpc -b master \ | |
&& cd grpc && git checkout c66d2cc \ | |
# move drachtio relevant modules into FreeSWITCH src dir | |
&& cp -r /usr/local/src/drachtio-freeswitch-modules/modules/mod_audio_fork /usr/local/src/freeswitch/src/mod/applications/ \ | |
&& cp -r /usr/local/src/drachtio-freeswitch-modules/modules/mod_google_tts /usr/local/src/freeswitch/src/mod/applications/ \ | |
&& cp -r /usr/local/src/drachtio-freeswitch-modules/modules/mod_google_transcribe /usr/local/src/freeswitch/src/mod/applications/ \ | |
&& cp -r /usr/local/src/drachtio-freeswitch-modules/modules/mod_dialogflow /usr/local/src/freeswitch/src/mod/applications/ \ | |
# copy build scripts (different from standard FreeSWITCH) | |
&& cd /usr/src/freeswitch/ \ | |
&& cp ../freeswitch-files/configure.ac . \ | |
&& cp ../freeswitch-files/Makefile.am . \ | |
&& cp ../freeswitch-files/modules.conf.in ./build \ | |
&& cp ../freeswitch-files/modules.conf.vanilla.xml ./conf/vanilla/autoload_configs/modules.conf.xml \ | |
&& cd /usr/src/freeswitch/libs \ | |
# build libwebsockets | |
&& cd /usr/src/freeswitch/libs/ \ | |
&& git clone https://github.com/warmcat/libwebsockets.git -b v3.2.3 \ | |
&& cd libwebsockets && mkdir -p build && cd build && cmake .. && make -j 4 && make install \ | |
# build libfvad | |
&& cd /usr/src/freeswitch/libs/ \ | |
&& git clone https://github.com/dpirch/libfvad.git \ | |
&& cd libfvad && autoreconf -i && ./configure && make -j 4 && make install \ | |
# build spandsp (no longer built-in into FreeSWITCH since 1.10.4) | |
&& cd /usr/src/freeswitch/libs/ \ | |
&& git clone https://github.com/freeswitch/spandsp \ | |
&& cd spandsp && ./bootstrap.sh && ./configure && make install \ | |
# build sofia (no longer built-in into FS since 1.10.4)) | |
&& cd /usr/src/freeswitch/libs/ \ | |
&& git clone https://github.com/freeswitch/sofia-sip \ | |
&& cd sofia-sip && ./bootstrap.sh && ./configure && make install \ | |
# build grpc | |
&& export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/:$LD_LIBRARY_PATH \ | |
&& cd /usr/src/grpc \ | |
&& git submodule update --init --recursive \ | |
&& export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/:$LD_LIBRARY_PATH \ | |
&& mkdir -p cmake/build && cd cmake/build \ | |
&& cmake -DBUILD_SHARED_LIBS=ON -DgRPC_SSL_PROVIDER=package -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo ../.. \ | |
&& make -j 4 \ | |
&& make install \ | |
# build googleapis | |
&& cd /usr/src/freeswitch/libs \ | |
&& git clone https://github.com/googleapis/googleapis -b master \ | |
&& cd googleapis && git checkout e9da6f8b469c52b83f900e820be30762e9e05c57 \ | |
# https://github.com/GoogleCloudPlatform/cpp-samples/issues/113#issuecomment-782347107 | |
&& sed -i 's/\$fields/fields/' google/maps/routes/v1/route_service.proto \ | |
&& sed -i 's/\$fields/fields/' google/maps/routes/v1alpha/route_service.proto \ | |
# make changes to fix libs not found errors | |
&& cp /usr/src/grpc/cmake/build/grpc_cpp_plugin /usr/local/bin/grpc_cpp_plugin \ | |
&& cp -r /usr/src/grpc/third_party/abseil-cpp/absl /usr/local/include/ \ | |
&& cd /usr/src/freeswitch/libs/googleapis && LANGUAGE=cpp make -j 4 | |
RUN cd /usr/src/freeswitch \ | |
&& ./bootstrap.sh -j && ./configure --with-lws=yes --with-extra=yes \ | |
&& make -j 4 && make install | |
RUN mkdir -p $CFG_DIR \ | |
&& cp -r /usr/local/freeswitch/conf/* $CFG_DIR/ \ | |
&& cd $CFG_DIR \ | |
&& rm -Rf diaplan/* sip_profiles/* htdocs fonts images | |
WORKDIR /usr/local/freeswitch/bin/ | |
CMD ./freeswitch -conf $CFG_DIR -log /var/log/freeswitch -db /usr/local/freeswitch/db | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment