pkg/kamailio/alpine_docker: Alpine docker scripts moved to subproject 1323/head
authorSergey Safarov <s.safarov@gmail.com>
Tue, 7 Nov 2017 21:45:27 +0000 (16:45 -0500)
committerSergey Safarov <s.safarov@gmail.com>
Wed, 22 Nov 2017 13:45:31 +0000 (08:45 -0500)
.gitmodules [new file with mode: 0644]
pkg/docker [new submodule]
pkg/kamailio/alpine/APKBUILD
pkg/kamailio/alpine_docker/Dockerfile [deleted file]
pkg/kamailio/alpine_docker/README.md [deleted file]
pkg/kamailio/alpine_docker/build.sh [deleted file]
pkg/kamailio/alpine_docker/hooks/pre_build [deleted file]

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..f03308d
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "pkg/docker"]
+       path = pkg/docker
+       url = https://github.com/kamailio/kamailio-ci.git
diff --git a/pkg/docker b/pkg/docker
new file mode 160000 (submodule)
index 0000000..27cd32c
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 27cd32c1c5fa799cb3b240c25e90ed83a0812b6c
index 5a74de5..6401924 100644 (file)
@@ -2,6 +2,7 @@
 # Contributor: Michael Mason <ms13sp@gmail.com>
 # Contributor: Leonardo Arena <rnalrd@gmail.com>
 # Maintainer: Nathan Angelacos <nangel@alpinelinux.org>
+
 pkgname=kamailio
 pkgver=5.1.0
 pkgrel=0
diff --git a/pkg/kamailio/alpine_docker/Dockerfile b/pkg/kamailio/alpine_docker/Dockerfile
deleted file mode 100644 (file)
index 5933ce2..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-FROM scratch
-
-ADD kamailio_img.tar.gz /
-
-ENTRYPOINT ["kamailio", "-DD", "-E"]
diff --git a/pkg/kamailio/alpine_docker/README.md b/pkg/kamailio/alpine_docker/README.md
deleted file mode 100644 (file)
index ffc1a67..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-About
------
-
-Container designed to run on host, bridge and swarm network.
-Size of container decreased to 50MB (23MB compressed)
-Significantly increased security - removed all libs except libc, busybox, tcpdump, dumpcap, kamailio and dependent libs.
-Docker container is created useing Alpine linux packaging
-
-Usage container
----------------
-
-```sh
-docker run --net=host --name kamailio \
-           -v /etc/kamailio/:/etc/kamailio \
-           kamailio/kamailio -m 64 -M 8
-```
-
-systemd unit file
------------------
-
-You can use this systemd unit files on your docker host.
-Unit file can be placed to ```/etc/systemd/system/kamailio-docker.service``` and enabled by commands
-```sh
-systemd start kamailio-docker.service
-systemd enable kamailio-docker.service
-```
-
-host network
-============
-
-```sh
-$ cat /etc/systemd/system/kamailio-docker.service
-[Unit]
-Description=kamailio Container
-After=docker.service network-online.target
-Requires=docker.service
-
-
-[Service]
-Restart=always
-TimeoutStartSec=0
-#One ExecStart/ExecStop line to prevent hitting bugs in certain systemd versions
-ExecStart=/bin/sh -c 'docker rm -f kamailio; \
-          docker run -t --net=host --name kamailio \
-                 -v /etc/kamailio/:/etc/kamailio \
-                 kamailio/kamailio'
-ExecStop=-/bin/sh -c '/usr/bin/docker stop kamailio; \
-          /usr/bin/docker rm -f kamailio;'
-
-[Install]
-WantedBy=multi-user.target
-```
-
-default bridge network
-======================
-```sh
-[Unit]
-Description=kamailio Container
-After=docker.service network-online.target
-Requires=docker.service
-
-
-[Service]
-Restart=always
-TimeoutStartSec=0
-#One ExecStart/ExecStop line to prevent hitting bugs in certain systemd versions
-ExecStart=/bin/sh -c 'docker rm -f kamailio; \
-          docker run -t --network bridge --name kamailio \
-                 -p 5060:5060/udp -p 5060:5060 \
-                 -v /etc/kamailio/:/etc/kamailio \
-                 kamailio/kamailio'
-
-ExecStop=-/bin/sh -c '/usr/bin/docker stop kamailio; \
-          /usr/bin/docker rm -f kamailio;'
-
-[Install]
-WantedBy=multi-user.target
-```
-
-.bashrc file
-------------
-To simplify kamailio managment you can add alias for ```kamctl``` to ```.bashrc``` file as example bellow.
-```sh
-alias kamctl='docker exec -i -t kamailio /usr/sbin/kamctl'
-```
diff --git a/pkg/kamailio/alpine_docker/build.sh b/pkg/kamailio/alpine_docker/build.sh
deleted file mode 100755 (executable)
index 75516c2..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/bin/sh -e
-
-# This script is wrote by Sergey Safarov <s.safarov@gmail.com>
-
-BUILD_ROOT=/tmp/kamailio
-FILELIST=/tmp/filelist
-FILELIST_BINARY=/tmp/filelist_binary
-TMP_TAR=/tmp/kamailio_min.tar.gz
-IMG_TAR=kamailio_img.tar.gz
-
-prepare_build() {
-apk add --no-cache abuild git gcc build-base bison db-dev flex expat-dev perl-dev postgresql-dev python2-dev pcre-dev mariadb-dev \
-    libxml2-dev curl-dev unixodbc-dev confuse-dev ncurses-dev sqlite-dev lua-dev openldap-dev \
-    libressl-dev net-snmp-dev libuuid libev-dev jansson-dev json-c-dev libevent-dev linux-headers \
-    libmemcached-dev rabbitmq-c-dev hiredis-dev libmaxminddb-dev libunistring-dev freeradius-client-dev lksctp-tools-dev
-
-    adduser -D build && addgroup build abuild
-    echo "%abuild ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/abuild
-    su - build -c "git config --global user.name 'Your Full Name'"
-    su - build -c "git config --global user.email 'your@email.address'"
-    su - build -c "abuild-keygen -a -i"
-}
-
-build_and_install(){
-    cd /usr/src/kamailio
-    REPO_OWNER=$(git remote get-url origin 2> /dev/null | sed -e 's|^.*github.com/||' -e 's|^git@github.com:||' -e 's|/.*\.git||')
-    if [ ! -z "$REPO_OWNER" ]; then
-        sed -i -e "s:github.com/kamailio:github.com/$REPO_OWNER:" /usr/src/kamailio/pkg/kamailio/alpine/APKBUILD
-    fi
-    if [ ! -z "$GIT_TAG" ]; then
-        sed -i -e "s/^_gitcommit=.*/_gitcommit=$GIT_TAG/" /usr/src/kamailio/pkg/kamailio/alpine/APKBUILD
-    fi
-    chown -R build /usr/src/kamailio
-    su - build -c "cd /usr/src/kamailio/pkg/kamailio/alpine; abuild snapshot"
-    su - build -c "cd /usr/src/kamailio/pkg/kamailio/alpine; abuild -r"
-    cd /home/build/packages/kamailio/x86_64
-    ls -1 kamailio-*.apk |  xargs apk --no-cache --allow-untrusted add
-}
-
-list_installed_kamailio_packages() {
-       apk info | grep kamailio
-}
-
-kamailio_files() {
-    local PACKAGES
-    PACKAGES=$(apk info | grep kamailio)
-    PACKAGES="musl $PACKAGES"
-    for pkg in $PACKAGES
-    do
-        # list package files and filter package name
-        apk info --contents $pkg 2> /dev/null | sed -e '/\S\+ contains:/d'  -e '/^$/d' -e 's/^/\//'
-    done
-}
-
-extra_files() {
-    cat << EOF
-/etc
-/bin
-/bin/busybox
-/usr/bin
-/usr/bin/dumpcap
-/usr/lib
-/usr/sbin
-/usr/sbin/tcpdump
-/var
-/var/run
-/run
-/tmp
-EOF
-}
-
-sort_filelist() {
-    sort $FILELIST | uniq > $FILELIST.new
-    mv -f $FILELIST.new $FILELIST
-}
-
-filter_unnecessary_files() {
-# excluded following files and directories recursive
-# /usr/lib/debug/usr/lib/kamailio/
-# /usr/share/doc/kamailio
-# /usr/share/man
-# /usr/share/snmp
-
-    sed -i \
-        -e '\|^/usr/lib/debug/|d' \
-        -e '\|^/usr/share/doc/kamailio/|d' \
-        -e '\|^/usr/share/man/|d' \
-        -e '\|^/usr/share/snmp/|d' \
-        $FILELIST
-}
-
-ldd_helper() {
-    TESTFILE=$1
-    LD_PRELOAD=/usr/sbin/kamailio ldd $TESTFILE 2> /dev/null > /dev/null || return
-
-    LD_PRELOAD=/usr/sbin/kamailio ldd $TESTFILE | sed -e 's/^.* => //' -e 's/ (.*)//' -e 's/\s\+//' -e '/^ldd$/d'
-}
-
-find_binaries() {
-    rm -f $FILELIST_BINARY
-    set +e
-    for f in $(cat $FILELIST)
-    do
-        ldd_helper /$f >> $FILELIST_BINARY
-    done
-    set -e
-    sort $FILELIST_BINARY | sort | uniq > $FILELIST_BINARY.new
-    mv -f $FILELIST_BINARY.new $FILELIST_BINARY
-
-    # Resolving symbolic links and removing duplicates
-    cat $FILELIST_BINARY | xargs realpath > $FILELIST_BINARY.new
-    cat $FILELIST_BINARY.new >> $FILELIST_BINARY
-    sort $FILELIST_BINARY | sort | uniq > $FILELIST_BINARY.new
-    mv -f $FILELIST_BINARY.new $FILELIST_BINARY
-}
-
-tar_files() {
-    local TARLIST=/tmp/tarlist
-    cat $FILELIST > $TARLIST
-    cat $FILELIST_BINARY >> $TARLIST
-    tar -czf $TMP_TAR --no-recursion -T $TARLIST
-    rm -f $TARLIST
-}
-
-make_image_tar() {
-    mkdir -p $BUILD_ROOT
-    cd $BUILD_ROOT
-    tar xzf $TMP_TAR
-    /bin/busybox --install -s bin
-    tar czf /usr/src/kamailio/pkg/kamailio/alpine_docker/$IMG_TAR *
-}
-
-prepare_build
-build_and_install
-#install PCAP tools
-apk add --no-cache wireshark-common tcpdump
-
-kamailio_files > $FILELIST
-extra_files >> $FILELIST
-sort_filelist
-filter_unnecessary_files
-find_binaries
-tar_files
-make_image_tar
diff --git a/pkg/kamailio/alpine_docker/hooks/pre_build b/pkg/kamailio/alpine_docker/hooks/pre_build
deleted file mode 100755 (executable)
index 88be066..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash -e
-
-echo "=> Build Kamailio source code"
-
-if [ ! -z "$SOURCE_BRANCH" ];then
-    ENV_OPT="-e SOURCE_BRANCH=$SOURCE_BRANCH"
-fi
-
-if [ ! -z "$GIT_TAG" ];then
-    ENV_OPT="$ENV_OPT -e GIT_TAG=$GIT_TAG"
-fi
-
-docker run --volume=`pwd`/../../..:/usr/src/kamailio --volume=`pwd`/build.sh:/build.sh --entrypoint=/build.sh $ENV_OPT alpine:edge
-exit $?