diff --git a/debian-jessie-slim-1.4.44/Dockerfile b/debian-jessie-slim-1.4.44/Dockerfile new file mode 100644 index 0000000..a1db2a7 --- /dev/null +++ b/debian-jessie-slim-1.4.44/Dockerfile @@ -0,0 +1,17 @@ +# vim:set ft=dockerfile: +FROM debian:jessie-slim + +LABEL maintainer="Andrius Kairiukstis " + +ENV ASTERISK_VERSION 1.4.44 +ENV ASTERISK_ADDONS_VERSION 1.4.13 + +COPY build-asterisk.sh / +RUN /build-asterisk.sh + +EXPOSE 5060/udp 5060/tcp +VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk + +COPY docker-entrypoint.sh / +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["/usr/sbin/asterisk", "-vvvdddf", "-T", "-W", "-U", "asterisk", "-p"] diff --git a/debian-jessie-slim-1.4.44/build-asterisk.sh b/debian-jessie-slim-1.4.44/build-asterisk.sh new file mode 100755 index 0000000..e4311aa --- /dev/null +++ b/debian-jessie-slim-1.4.44/build-asterisk.sh @@ -0,0 +1,119 @@ +#!/bin/bash +PROGNAME=$(basename $0) + +if test -z ${ASTERISK_VERSION}; then + echo "${PROGNAME}: ASTERISK_VERSION required" >&2 + exit 1 +fi + +set -ex + +useradd --system asterisk + +apt-get update -qq +DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + autoconf \ + binutils-dev \ + build-essential \ + ca-certificates \ + curl \ + file \ + libcurl4-openssl-dev \ + libedit-dev \ + libgsm1-dev \ + libjansson-dev \ + libogg-dev \ + libpopt-dev \ + libresample1-dev \ + libspandsp-dev \ + libspeex-dev \ + libspeexdsp-dev \ + libsqlite3-dev \ + libssl-dev \ + libvorbis-dev \ + libxml2-dev \ + libxslt1-dev \ + portaudio19-dev \ + unixodbc \ + unixodbc-bin \ + unixodbc-dev \ + odbcinst \ + uuid \ + uuid-dev \ + xmlstarlet + +apt-get purge -y --auto-remove +rm -rf /var/lib/apt/lists/* + +mkdir -p /usr/src/asterisk \ + /usr/src/asterisk/addons + +cd /usr/src/asterisk/addons +curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-addons-${ASTERISK_ADDONS_VERSION}.tar.gz | tar --strip-components 1 -xz + +cd /usr/src/asterisk +curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz + +# 1.5 jobs per core works out okay +: ${JOBS:=$(( $(nproc) + $(nproc) / 2 ))} + +mkdir -p /etc/asterisk/ \ + /var/spool/asterisk/fax + +./configure --libdir=/usr/lib64 +make menuselect/menuselect menuselect-tree menuselect.makeopts + +# we don't need any sounds in docker, they will be mounted as volume +menuselect/menuselect --disable-category MENUSELECT_CORE_SOUNDS menuselect.makeopts +menuselect/menuselect --disable-category MENUSELECT_MOH menuselect.makeopts +menuselect/menuselect --disable-category MENUSELECT_EXTRA_SOUNDS menuselect.makeopts + +make -j ${JOBS} all +make install + +# copy default configs +# cp /usr/src/asterisk/configs/basic-pbx/*.conf /etc/asterisk/ +make samples +make dist-clean + +# set runuser and rungroup +sed -i -E 's/^;(run)(user|group)/\1\2/' /etc/asterisk/asterisk.conf +sed -i -e 's/# MAXFILES=/MAXFILES=/' /usr/sbin/safe_asterisk + +cd /usr/src/asterisk/addons + +./configure --libdir=/usr/lib64 +make menuselect/menuselect menuselect-tree menuselect.makeopts + +make -j ${JOBS} all +make install +make samples + +chown -R asterisk:asterisk /etc/asterisk \ + /var/*/asterisk \ + /usr/*/asterisk \ + /usr/lib64/asterisk +chmod -R 750 /var/spool/asterisk + +cd / +rm -rf /usr/src/asterisk \ + /usr/src/codecs + +# remove *-dev packages +devpackages=`dpkg -l|grep '\-dev'|awk '{print $2}'|xargs` +DEBIAN_FRONTEND=noninteractive apt-get --yes purge \ + autoconf \ + build-essential \ + bzip2 \ + cpp \ + m4 \ + make \ + patch \ + perl \ + perl-modules \ + pkg-config \ + xz-utils \ + ${devpackages} +rm -rf /var/lib/apt/lists/* + +exec rm -f /build-asterisk.sh diff --git a/debian-jessie-slim-1.4.44/docker-entrypoint.sh b/debian-jessie-slim-1.4.44/docker-entrypoint.sh new file mode 100755 index 0000000..f1f82f4 --- /dev/null +++ b/debian-jessie-slim-1.4.44/docker-entrypoint.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# run as user asterisk by default +ASTERISK_USER=${ASTERISK_USER:-asterisk} + +if [ "$1" = "" ]; then + COMMAND="/usr/sbin/asterisk -T -W -U ${ASTERISK_USER} -p -vvvdddf" +else + COMMAND="$@" +fi + +if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then + # recreate user and group for asterisk + # if they've sent as env variables (i.e. to macth with host user to fix permissions for mounted folders + + deluser asterisk && \ + adduser --gecos "" --no-create-home --uid ${ASTERISK_UID} --disabled-password ${ASTERISK_USER} \ + || exit +fi + +chown -R ${ASTERISK_USER}: /var/log/asterisk \ + /var/lib/asterisk \ + /var/run/asterisk \ + /var/spool/asterisk; \ +exec ${COMMAND} diff --git a/debian-stretch-slim-17-current/Dockerfile b/debian-stretch-slim-17-current/Dockerfile new file mode 100644 index 0000000..87fbc15 --- /dev/null +++ b/debian-stretch-slim-17-current/Dockerfile @@ -0,0 +1,17 @@ +# vim:set ft=dockerfile: +FROM debian:stretch-slim + +LABEL maintainer="Andrius Kairiukstis " + +ENV ASTERISK_VERSION 17.0.0-rc1 +ENV OPUS_CODEC asterisk-17.0/x86-64/codec_opus-17.0_current-x86_64 + +COPY build-asterisk.sh / +RUN /build-asterisk.sh + +EXPOSE 5060/udp 5060/tcp +VOLUME /var/lib/asterisk/sounds /var/lib/asterisk/keys /var/lib/asterisk/phoneprov /var/spool/asterisk /var/log/asterisk + +COPY docker-entrypoint.sh / +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["/usr/sbin/asterisk", "-vvvdddf", "-T", "-W", "-U", "asterisk", "-p"] diff --git a/debian-stretch-slim-17-current/Dockerfile-centos b/debian-stretch-slim-17-current/Dockerfile-centos new file mode 100644 index 0000000..0257721 --- /dev/null +++ b/debian-stretch-slim-17-current/Dockerfile-centos @@ -0,0 +1,145 @@ +FROM centos:6 + +MAINTAINER Andrius Kairiukstis + +RUN yum -y install gcc gcc-c++ cpp ncurses ncurses-devel libxml2 libxml2-devel openssl-devel \ + newt-devel libuuid-devel net-snmp-devel xinetd tar libffi-devel sqlite-devel curl bison supervisor \ + && mkdir /tmp/asterisk \ + && curl -sf -o /tmp/asterisk.tar.gz -L http://downloads.asterisk.org/pub/telephony/certified-asterisk/certified-asterisk-11.6-current.tar.gz \ + && tar -xzf /tmp/asterisk.tar.gz -C /tmp/asterisk --strip-components=1 \ + && cd /tmp/asterisk \ + && ./configure --libdir=/usr/lib64 \ + && make menuselect \ + && menuselect/menuselect \ + --disable-all \ + --disable-category MENUSELECT_ADDONS \ + --disable-category MENUSELECT_APPS \ + --disable-category MENUSELECT_BRIDGES \ + --disable-category MENUSELECT_CDR \ + --disable-category MENUSELECT_CEL \ + --disable-category MENUSELECT_CHANNELS \ + --enable-category MENUSELECT_CODECS \ + --enable-category MENUSELECT_FORMATS \ + --disable-category MENUSELECT_FUNCS \ + --disable-category MENUSELECT_PBX \ + --disable-category MENUSELECT_RES \ + --disable-category MENUSELECT_TESTS \ + --disable-category MENUSELECT_UTILS \ + --disable-category MENUSELECT_AGIS \ + --disable-category MENUSELECT_EMBED \ + --enable-category MENUSELECT_CORE_SOUNDS \ + --enable-category MENUSELECT_MOH \ + --enable-category MENUSELECT_EXTRA_SOUNDS \ + --disable-category MENUSELECT_TESTS \ + --enable-category MENUSELECT_OPTS_app_voicemail \ + --enable func_module \ + --enable LOADABLE_MODULES \ + --enable FILE_STORAGE \ + --disable codec_dahdi \ + --enable app_dial \ + --enable app_exec \ + --enable app_originate \ + --enable app_verbose \ + --enable chan_sip \ + --enable pbx_config \ + --enable res_agi \ + --enable res_convert \ + --enable res_musiconhold \ + --enable res_timing_timerfd \ + --disable BUILD_NATIVE \ + menuselect.makeopts \ + && make config \ + && make \ + && make install \ + && mkdir -p /var/lib/asterisk/phoneprov \ + && make samples \ + && make dist-clean \ + && sed -i -e 's/# MAXFILES=/MAXFILES=/' /usr/sbin/safe_asterisk \ + && cd .. \ + && rm /tmp/asterisk.tar.gz \ + && rm -rf /tmp/asterisk \ + && yum -y clean all \ + && rm -rf /var/cache/yum/* + + +# RUN yum -y update \ +# && yum -y install epel-release \ +# && yum -y install kernel-headers gcc gcc-c++ cpp ncurses ncurses-devel libxml2 libxml2-devel sqlite sqlite-devel \ +# mysql-devel openssl-devel newt-devel kernel-devel libuuid-devel net-snmp-devel xinetd tar libffi-devel \ +# curl pcre-devel bison mysql-devel ngrep tmux \ +# && mkdir /tmp/asterisk \ +# && curl -sf -o /tmp/asterisk.tar.gz -L http://downloads.asterisk.org/pub/telephony/certified-asterisk/certified-asterisk-11.6-current.tar.gz \ +# && tar -xzf /tmp/asterisk.tar.gz -C /tmp/asterisk --strip-components=1 \ +# && cd /tmp/asterisk \ +# && ./configure --libdir=/usr/lib64 \ +# && make menuselect \ +# && menuselect/menuselect \ +# --disable-category MENUSELECT_ADDONS \ +# --disable-category MENUSELECT_APPS \ +# --disable-category MENUSELECT_BRIDGES \ +# --disable-category MENUSELECT_CDR \ +# --disable-category MENUSELECT_CEL \ +# --disable-category MENUSELECT_CHANNELS \ +# --enable-category MENUSELECT_CODECS \ +# --enable-category MENUSELECT_FORMATS \ +# --disable-category MENUSELECT_FUNCS \ +# --disable-category MENUSELECT_PBX \ +# --disable-category MENUSELECT_RES \ +# --disable-category MENUSELECT_TESTS \ +# --disable-category MENUSELECT_OPTS_app_voicemail \ +# --disable-category MENUSELECT_UTILS \ +# --disable-category MENUSELECT_AGIS \ +# --disable-category MENUSELECT_EMBED \ +# --disable-category MENUSELECT_CORE_SOUNDS \ +# --disable-category MENUSELECT_MOH \ +# --disable-category MENUSELECT_EXTRA_SOUNDS \ +# --enable app_controlplayback \ +# --enable app_dial \ +# --enable app_exec \ +# --enable app_originate \ +# --enable app_queue \ +# --enable app_record \ +# --enable app_senddtmf \ +# --enable app_stasis \ +# --enable app_verbose \ +# --enable app_waituntil \ +# --enable chan_sip \ +# --enable pbx_config \ +# --enable pbx_realtime \ +# --enable res_agi \ +# --enable res_ari \ +# --enable res_ari_channels \ +# --enable res_ari_events \ +# --enable res_ari_playbacks \ +# --enable res_ari_recordings \ +# --enable res_ari_sounds \ +# --enable res_ari_device_states \ +# --enable res_realtime \ +# --enable res_rtp_asterisk \ +# --enable res_rtp_multicast \ +# --enable res_stasis \ +# --enable res_stasis_answer \ +# --enable res_stasis_device_state \ +# --enable res_stasis_playback \ +# --enable res_stasis_recording \ +# --enable res_stun_monitor \ +# --enable res_timing_timerfd \ +# --enable func_callcompletion \ +# --enable func_callerid \ +# --disable BUILD_NATIVE \ +# menuselect.makeopts \ +# && make config \ +# && make \ +# && make install \ +# && mkdir -p /var/lib/asterisk/phoneprov \ +# && make samples \ +# && make dist-clean \ +# && sed -i -e 's/# MAXFILES=/MAXFILES=/' /usr/sbin/safe_asterisk \ +# && cd .. \ +# && rm /tmp/asterisk.tar.gz \ +# && rm -rf /tmp/asterisk \ +# && yum -y clean all \ +# && rm -rf /var/cache/yum/* +# +# CMD asterisk -fvvvvv + diff --git a/debian-stretch-slim-17-current/build-asterisk.sh b/debian-stretch-slim-17-current/build-asterisk.sh new file mode 100755 index 0000000..cd88e25 --- /dev/null +++ b/debian-stretch-slim-17-current/build-asterisk.sh @@ -0,0 +1,132 @@ +#!/bin/bash +PROGNAME=$(basename $0) + +if test -z ${ASTERISK_VERSION}; then + echo "${PROGNAME}: ASTERISK_VERSION required" >&2 + exit 1 +fi + +set -ex + +useradd --system asterisk + +apt-get update -qq +DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends --no-install-suggests \ + autoconf \ + binutils-dev \ + build-essential \ + ca-certificates \ + curl \ + file \ + libcurl4-openssl-dev \ + libedit-dev \ + libgsm1-dev \ + libogg-dev \ + libpopt-dev \ + libresample1-dev \ + libspandsp-dev \ + libspeex-dev \ + libspeexdsp-dev \ + libsqlite3-dev \ + libsrtp0-dev \ + libssl-dev \ + libvorbis-dev \ + libxml2-dev \ + libxslt1-dev \ + procps \ + portaudio19-dev \ + unixodbc \ + unixodbc-bin \ + unixodbc-dev \ + odbcinst \ + uuid \ + uuid-dev \ + xmlstarlet + +apt-get purge -y --auto-remove +rm -rf /var/lib/apt/lists/* + +mkdir -p /usr/src/asterisk +cd /usr/src/asterisk + +curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz || \ +curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz || \ +curl -vsL http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-${ASTERISK_VERSION}.tar.gz | tar --strip-components 1 -xz + +# 1.5 jobs per core works out okay +: ${JOBS:=$(( $(nproc) + $(nproc) / 2 ))} + +./configure --with-resample \ + --with-pjproject-bundled \ + --with-jansson-bundled +make menuselect/menuselect menuselect-tree menuselect.makeopts + +# disable BUILD_NATIVE to avoid platform issues +menuselect/menuselect --disable BUILD_NATIVE menuselect.makeopts + +# enable good things +menuselect/menuselect --enable BETTER_BACKTRACES menuselect.makeopts + +# codecs +# menuselect/menuselect --enable codec_opus menuselect.makeopts +# menuselect/menuselect --enable codec_silk menuselect.makeopts + +# # download more sounds +# for i in CORE-SOUNDS-EN MOH-OPSOUND EXTRA-SOUNDS-EN; do +# for j in ULAW ALAW G722 GSM SLN16; do +# menuselect/menuselect --enable $i-$j menuselect.makeopts +# done +# done + +# we don't need any sounds in docker, they will be mounted as volume +menuselect/menuselect --disable-category MENUSELECT_CORE_SOUNDS +menuselect/menuselect --disable-category MENUSELECT_MOH +menuselect/menuselect --disable-category MENUSELECT_EXTRA_SOUNDS + +make -j ${JOBS} all +make install + +# copy default configs +# cp /usr/src/asterisk/configs/basic-pbx/*.conf /etc/asterisk/ +make samples + +# set runuser and rungroup +sed -i -E 's/^;(run)(user|group)/\1\2/' /etc/asterisk/asterisk.conf + +# Install opus, for some reason menuselect option above does not working +mkdir -p /usr/src/codecs/opus \ + && cd /usr/src/codecs/opus \ + && curl -vsL http://downloads.digium.com/pub/telephony/codec_opus/${OPUS_CODEC}.tar.gz | tar --strip-components 1 -xz \ + && cp *.so /usr/lib/asterisk/modules/ \ + && cp codec_opus_config-en_US.xml /var/lib/asterisk/documentation/ + +mkdir -p /etc/asterisk/ \ + /var/spool/asterisk/fax + +chown -R asterisk:asterisk /etc/asterisk \ + /var/*/asterisk \ + /usr/*/asterisk +chmod -R 750 /var/spool/asterisk + +cd / +rm -rf /usr/src/asterisk \ + /usr/src/codecs + +# remove *-dev packages +devpackages=`dpkg -l|grep '\-dev'|awk '{print $2}'|xargs` +DEBIAN_FRONTEND=noninteractive apt-get --yes purge \ + autoconf \ + build-essential \ + bzip2 \ + cpp \ + m4 \ + make \ + patch \ + perl \ + perl-modules \ + pkg-config \ + xz-utils \ + ${devpackages} +rm -rf /var/lib/apt/lists/* + +exec rm -f /build-asterisk.sh diff --git a/debian-stretch-slim-17-current/docker-entrypoint.sh b/debian-stretch-slim-17-current/docker-entrypoint.sh new file mode 100755 index 0000000..a82f419 --- /dev/null +++ b/debian-stretch-slim-17-current/docker-entrypoint.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +# run as user asterisk by default +ASTERISK_USER=${ASTERISK_USER:-asterisk} + +if [ "$1" = "" ]; then + COMMAND="/usr/sbin/asterisk -T -W -U ${ASTERISK_USER} -p -vvvdddf" +else + COMMAND="$@" +fi + +if [ "${ASTERISK_UID}" != "" ] && [ "${ASTERISK_GID}" != "" ]; then + # recreate user and group for asterisk + # if they've sent as env variables (i.e. to macth with host user to fix permissions for mounted folders + + deluser asterisk && \ + adduser --gecos "" --no-create-home --uid ${ASTERISK_UID} --disabled-password ${ASTERISK_USER} || exit + + chown -R ${ASTERISK_UID}:${ASTERISK_UID} /etc/asterisk \ + /var/*/asterisk \ + /usr/*/asterisk +fi + +exec ${COMMAND}