<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/docker-playground/+/21736">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Import freeswitch Dockerfile<br><br>Use https://github.com/signalwire/freeswitch current master<br>(ae0444e9cbccdee55a80467d605e1e8c3363a36d) which has ancient<br>Docker containers.<br><br>Change-Id: Ib859b0ac869a82239a8c54c6e14ffa36e6497cd4<br>---<br>A freeswitch/Dockerfile<br>A freeswitch/build/freeswitch.limits.conf<br>A freeswitch/docker-entrypoint.sh<br>3 files changed, 119 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/docker-playground refs/changes/36/21736/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/freeswitch/Dockerfile b/freeswitch/Dockerfile</span><br><span>new file mode 100644</span><br><span>index 0000000..ef37e93</span><br><span>--- /dev/null</span><br><span>+++ b/freeswitch/Dockerfile</span><br><span>@@ -0,0 +1,77 @@</span><br><span style="color: hsl(120, 100%, 40%);">+# vim:set ft=dockerfile:</span><br><span style="color: hsl(120, 100%, 40%);">+FROM debian:jessie</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Source Dockerfile:</span><br><span style="color: hsl(120, 100%, 40%);">+# https://github.com/docker-library/postgres/blob/master/9.4/Dockerfile</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# explicitly set user/group IDs</span><br><span style="color: hsl(120, 100%, 40%);">+RUN groupadd -r freeswitch --gid=999 && useradd -r -g freeswitch --uid=999 freeswitch</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# grab gosu for easy step-down from root</span><br><span style="color: hsl(120, 100%, 40%);">+RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4</span><br><span style="color: hsl(120, 100%, 40%);">+RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \</span><br><span style="color: hsl(120, 100%, 40%);">+    && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture)" \</span><br><span style="color: hsl(120, 100%, 40%);">+    && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \</span><br><span style="color: hsl(120, 100%, 40%);">+    && gpg --verify /usr/local/bin/gosu.asc \</span><br><span style="color: hsl(120, 100%, 40%);">+    && rm /usr/local/bin/gosu.asc \</span><br><span style="color: hsl(120, 100%, 40%);">+    && chmod +x /usr/local/bin/gosu \</span><br><span style="color: hsl(120, 100%, 40%);">+    && apt-get purge -y --auto-remove ca-certificates wget</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# make the "en_US.UTF-8" locale so freeswitch will be utf-8 enabled by default</span><br><span style="color: hsl(120, 100%, 40%);">+RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \</span><br><span style="color: hsl(120, 100%, 40%);">+    && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8</span><br><span style="color: hsl(120, 100%, 40%);">+ENV LANG en_US.utf8</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# https://files.freeswitch.org/repo/deb/freeswitch-1.*/dists/jessie/main/binary-amd64/Packages</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ENV FS_MAJOR 1.6</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+RUN sed -i "s/jessie main/jessie main contrib non-free/" /etc/apt/sources.list</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# https://freeswitch.org/confluence/display/FREESWITCH/Debian+8+Jessie#Debian8Jessie-InstallingfromDebianpackages</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+RUN apt-get update && apt-get install -y curl \</span><br><span style="color: hsl(120, 100%, 40%);">+    && curl https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add - \</span><br><span style="color: hsl(120, 100%, 40%);">+    && echo "deb http://files.freeswitch.org/repo/deb/freeswitch-$FS_MAJOR/ jessie main" > /etc/apt/sources.list.d/freeswitch.list \</span><br><span style="color: hsl(120, 100%, 40%);">+    && apt-get purge -y --auto-remove curl</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+RUN apt-get update && apt-get install -y freeswitch-all \</span><br><span style="color: hsl(120, 100%, 40%);">+    && apt-get clean && rm -rf /var/lib/apt/lists/*</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Clean up</span><br><span style="color: hsl(120, 100%, 40%);">+RUN apt-get autoremove</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+COPY docker-entrypoint.sh /</span><br><span style="color: hsl(120, 100%, 40%);">+## Ports</span><br><span style="color: hsl(120, 100%, 40%);">+# Open the container up to the world.</span><br><span style="color: hsl(120, 100%, 40%);">+### 8021 fs_cli, 5060 5061 5080 5081 sip and sips, 64535-65535 rtp</span><br><span style="color: hsl(120, 100%, 40%);">+EXPOSE 8021/tcp</span><br><span style="color: hsl(120, 100%, 40%);">+EXPOSE 5060/tcp 5060/udp 5080/tcp 5080/udp</span><br><span style="color: hsl(120, 100%, 40%);">+EXPOSE 5061/tcp 5061/udp 5081/tcp 5081/udp</span><br><span style="color: hsl(120, 100%, 40%);">+EXPOSE 7443/tcp</span><br><span style="color: hsl(120, 100%, 40%);">+EXPOSE 5070/udp 5070/tcp</span><br><span style="color: hsl(120, 100%, 40%);">+EXPOSE 64535-65535/udp</span><br><span style="color: hsl(120, 100%, 40%);">+EXPOSE 16384-32768/udp</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Volumes</span><br><span style="color: hsl(120, 100%, 40%);">+## Freeswitch Configuration</span><br><span style="color: hsl(120, 100%, 40%);">+VOLUME ["/etc/freeswitch"]</span><br><span style="color: hsl(120, 100%, 40%);">+## Tmp so we can get core dumps out</span><br><span style="color: hsl(120, 100%, 40%);">+VOLUME ["/tmp"]</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Limits Configuration</span><br><span style="color: hsl(120, 100%, 40%);">+COPY    build/freeswitch.limits.conf /etc/security/limits.d/</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Healthcheck to make sure the service is running</span><br><span style="color: hsl(120, 100%, 40%);">+SHELL       ["/bin/bash"]</span><br><span style="color: hsl(120, 100%, 40%);">+HEALTHCHECK --interval=15s --timeout=5s \</span><br><span style="color: hsl(120, 100%, 40%);">+    CMD  fs_cli -x status | grep -q ^UP || exit 1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+## Add additional things here</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+##</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ENTRYPOINT ["/docker-entrypoint.sh"]</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+CMD ["freeswitch"]</span><br><span>diff --git a/freeswitch/build/freeswitch.limits.conf b/freeswitch/build/freeswitch.limits.conf</span><br><span>new file mode 100644</span><br><span>index 0000000..d6568eb</span><br><span>--- /dev/null</span><br><span>+++ b/freeswitch/build/freeswitch.limits.conf</span><br><span>@@ -0,0 +1,15 @@</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    core            unlimited</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    data            unlimited</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    fsize           unlimited</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    memlock         unlimited</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    nofile          999999</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    rss             unlimited</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       hard    stack           240</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    cpu             unlimited</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    nproc           unlimited</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    as              unlimited</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    priority        -11</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    locks           unlimited</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    sigpending      unlimited</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    msgqueue        unlimited</span><br><span style="color: hsl(120, 100%, 40%);">+freeswitch       soft    nice            -11</span><br><span>diff --git a/freeswitch/docker-entrypoint.sh b/freeswitch/docker-entrypoint.sh</span><br><span>new file mode 100644</span><br><span>index 0000000..8b645a2</span><br><span>--- /dev/null</span><br><span>+++ b/freeswitch/docker-entrypoint.sh</span><br><span>@@ -0,0 +1,27 @@</span><br><span style="color: hsl(120, 100%, 40%);">+#!/bin/bash</span><br><span style="color: hsl(120, 100%, 40%);">+set -e</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# Source docker-entrypoint.sh:</span><br><span style="color: hsl(120, 100%, 40%);">+# https://github.com/docker-library/postgres/blob/master/9.4/docker-entrypoint.sh</span><br><span style="color: hsl(120, 100%, 40%);">+# https://github.com/kovalyshyn/docker-freeswitch/blob/vanilla/docker-entrypoint.sh</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+if [ "$1" = 'freeswitch' ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    if [ ! -f "/etc/freeswitch/freeswitch.xml" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+        mkdir -p /etc/freeswitch</span><br><span style="color: hsl(120, 100%, 40%);">+        cp -varf /usr/share/freeswitch/conf/vanilla/* /etc/freeswitch/</span><br><span style="color: hsl(120, 100%, 40%);">+    fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    chown -R freeswitch:freeswitch /etc/freeswitch</span><br><span style="color: hsl(120, 100%, 40%);">+    chown -R freeswitch:freeswitch /var/{run,lib}/freeswitch</span><br><span style="color: hsl(120, 100%, 40%);">+    </span><br><span style="color: hsl(120, 100%, 40%);">+    if [ -d /docker-entrypoint.d ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+        for f in /docker-entrypoint.d/*.sh; do</span><br><span style="color: hsl(120, 100%, 40%);">+            [ -f "$f" ] && . "$f"</span><br><span style="color: hsl(120, 100%, 40%);">+        done</span><br><span style="color: hsl(120, 100%, 40%);">+    fi</span><br><span style="color: hsl(120, 100%, 40%);">+    </span><br><span style="color: hsl(120, 100%, 40%);">+    exec gosu freeswitch /usr/bin/freeswitch -u freeswitch -g freeswitch -nonat -c</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+exec "$@"</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/docker-playground/+/21736">change 21736</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/docker-playground/+/21736"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: docker-playground </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ib859b0ac869a82239a8c54c6e14ffa36e6497cd4 </div>
<div style="display:none"> Gerrit-Change-Number: 21736 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>