diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e69de29 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a95b23a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.bingkey diff --git a/Dockerfile b/Dockerfile index fa7ad6b..4191cac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ FROM debian:jessie -MAINTAINER "Lorenzo Mangani " +LABEL MAINTAINER "Lorenzo Mangani " USER root -RUN apt-get update && apt-get install -y sudo git make bison flex curl && \ +RUN apt-get update && apt-get install -y sudo git make bison flex curl libz-dev libssl-dev x11-apps && \ echo "mysql-server mysql-server/root_password password passwd" | sudo debconf-set-selections && \ echo "mysql-server mysql-server/root_password_again password passwd" | sudo debconf-set-selections && \ apt-get install -y mysql-server libmysqlclient-dev \ @@ -31,21 +31,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ #cp /lib/modules/$(uname -r)/extra/xt_RTPENGINE.ko /rtpengine/xt_RTPENGINE.ko && \ apt-get clean - RUN apt-get purge -y bison build-essential ca-certificates flex git m4 pkg-config curl && \ apt-get autoremove -y && \ apt-get install -y libmicrohttpd10 rsyslog ngrep && \ apt-get clean -COPY conf/opensipsctlrc /usr/local/etc/opensips/opensipsctlrc -COPY conf/opensips-rtpengine.cfg /usr/local/etc/opensips/opensips.cfg -COPY rtpengine/rtpengine-recording.conf /etc/rtpengine/rtpengine-recording.conf - -COPY boot_run.sh /etc/boot_run.sh -RUN chown root.root /etc/boot_run.sh && chmod 700 /etc/boot_run.sh - RUN apt install -y curl git && \ - curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - && \ + curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - && \ apt-get install -y nodejs && \ cd /opt && git clone https://github.com/lmangani/RTPEngine-Speech2Text && \ cd RTPEngine-Speech2Text && npm install && npm install -g forever @@ -56,5 +48,9 @@ EXPOSE 9060/udp EXPOSE 9060/tcp EXPOSE 6060/udp EXPOSE 20000-20100/udp - +COPY conf/opensipsctlrc /usr/local/etc/opensips/opensipsctlrc +COPY conf/opensips-rtpengine.cfg /usr/local/etc/opensips/opensips.cfg +COPY rtpengine/rtpengine-recording.conf /etc/rtpengine/rtpengine-recording.conf +COPY boot_run.sh /etc/boot_run.sh +RUN chown root.root /etc/boot_run.sh && chmod 700 /etc/boot_run.sh ENTRYPOINT ["/etc/boot_run.sh"] diff --git a/boot_run.sh b/boot_run.sh index 22762b1..1e1d313 100755 --- a/boot_run.sh +++ b/boot_run.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -x # OpenSIPS Docker bootstrap MYSQL_PWD=${MYSQL_PWD:-"passwd"} @@ -8,14 +9,14 @@ ADVERTISED_PORT=${ADVERTISED_PORT:-"5060"} ADVERTISED_RANGE_FIRST=${ADVERTISED_RANGE_FIRST:-"20000"} ADVERTISED_RANGE_LAST=${ADVERTISED_RANGE_LAST:-"20100"} WSS_PORT=${WSS_PORT:-"5061"} - +mkdir -p /lib/modules/$(uname -r)/updates HOST_IP=$(ip route get 8.8.8.8 | awk '{print $NF; exit}') echo "Your IP : ${HOST_IP}" echo "Public IP : ${EXTERNAL_IP}" echo -e "Advertised IP:PORT : ${ADVERTISED_IP}:${ADVERTISED_PORT}\n\n" echo -e "Advertised RTP Range : ${ADVERTISED_RANGE_FIRST}-${ADVERTISED_RANGE_LAST}\n\n" - +uname -r # Starting MySQL service mysql start @@ -38,11 +39,11 @@ sed -i "s/listen=udp.*/listen=udp:${HOST_IP}:${ADVERTISED_PORT}/g" /usr/local/et sed -i "s/listen=ws.*/listen=ws:${HOST_IP}:${WSS_PORT}/g" /usr/local/etc/opensips/opensips.cfg # Prepare RTPEngine modules -mkdir /lib/modules/$(uname -r)/updates -cp -u /rtpengine/xt_RTPENGINE.ko "/lib/modules/$(uname -r)/updates/xt_RTPENGINE.ko" + +cp -fu /rtpengine/xt_RTPENGINE.ko "/lib/modules/$(uname -r)/updates/xt_RTPENGINE.ko" depmod -a modprobe xt_RTPENGINE -mkdir /recording +mkdir -p /recording # Starting RTPEngine process echo 'del 0' > /proc/rtpengine/control || true rtpengine-recording --config-file=/etc/rtpengine/rtpengine-recording.conf diff --git a/docker-compose.yml b/docker-compose.yml index 3473f83..afd29bc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,7 @@ version: '2.2' services: opensips-rec: + build: . image: qxip/docker-rtpengine-speech privileged: true restart: always @@ -9,10 +10,14 @@ services: ADVERTISED_RANGE_LAST: 20100 HOMER_SERVER: '127.0.0.1' HOMER_PORT: 9060 - BING_KEY: 'YOUR_KEY_HERE' + BING_KEY: ${BING_KEY} volumes: - /var/lib/mysql - /recording + - conf/opensipsctlrc:/usr/local/etc/opensips/opensipsctlrc + - conf/opensips-rtpengine.cfg:/usr/local/etc/opensips/opensips.cfg + - rtpengine/rtpengine-recording.conf:/etc/rtpengine/rtpengine-recording.conf + - boot_run.sh:/etc/boot_run.sh ports: - "9060:9060/udp" - "5060:5060/udp"