GitLab(GitHub) : flexisip/docker ディレクトリ内の各ファイルの利用方法

ソースからビルドする場合の開発環境イメージの作成

flexisip/dockerディレクトリについての具体的な説明は、Debian10による開発環境下でソースからflexisipイメージをビルドする記述のみとなっています。このディレクトリにはDebian, Ubuntu, Rocky Linux, Arch Linuxなどの各種ディストリビューションで開発環境イメージを構築できるDockerfile(bc-dev-*)が予め用意されているため、flexisipをソースからビルドする場合には、このDockerfileから開発環境イメージを作成しコンテナ内で作業する方が良いでしょう。またMakefileにはビルドするためのヒントとなる記述があるため、これを参照することをお薦めします。

ex) bc-dev-ubuntu-22-04から開発環境イメージ作成

$ docker build -f bc-dev-ubuntu-22-04 -t bc-dev-ubuntu:22-04 --rm .
or
$ docker build -f bc-dev-ubuntu-22-04 --pull --no-cache -t bc-dev-ubuntu:22-04 --rm .

上記イメージから開発環境コンテナ起動($PWD:flexisipソースディレクトリで実行)

$ docker run --name flexisip-sdk -v $PWD:/home/bc -it bc-dev-ubuntu:22-04 bash

コンテナ内でビルド

# mkdir build
# cd build
# cmake .. -DCMAKE_INSTALL_PREFIX=/opt/belledonne-communications -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSYSCONF_INSTALL_DIR=/etc -DCPACK_GENERATOR=DEB
# make package

最新安定版のflexisip Dockerイメージの作成

Belledonne Communicationsのリポジトリをソースリストに追加することで、最新安定版のflexisipをインストールすることが出来ます。開発中のアルファ、ベータ版の試用やカスタマイズして運用する用途以外ではソースからビルドしたflexisipを使用するのではなく、リポジトリを追加してインストールされる最新安定版を使用した方が良いでしょう。

ソースからビルドしたflexisipパッケージをインストールしてflexisipを起動するDockerfile:flex-from-debを参照してBelledonne Communications APT repo を追加した最新安定版のflexisipを起動するDockerfile:flex-from-ubuntu-apt-repoを作成 (Ubuntu 22.04)

flex-from-ubuntu-apt-repo

FROM ubuntu:22.04
MAINTAINER  Takanobu Fuse <ficusonline@gmail.com>

# Prepare dependencies
RUN apt-get update
RUN apt-get install -y nano xsdcxx gdb libmariadb3 snmp-mibs-downloader snmp snmpd iproute2 iptables wget gnupg2
RUN echo 'deb [arch=amd64] http://linphone.org/snapshots/ubuntu jammy stable' > /etc/apt/sources.list.d/belledonne.list
RUN wget https://www.linphone.org/snapshots/ubuntu/pubkey.gpg -O - | apt-key add -
RUN apt-get update && apt-get install -y bc-flexisip

# Add it to the default path
ENV PATH=$PATH:/opt/belledonne-communications/bin

WORKDIR /opt/belledonne-communications

# Generate a default configuration
RUN flexisip --dump-default all > /etc/flexisip/flexisip.conf

VOLUME /etc/opt/belledonne-communications/flexisip
VOLUME /var/opt/belledonne-communications/log/flexisip
COPY flexisip-entrypoint.sh /
COPY backtrace.gdb /
RUN chmod a+x /flexisip-entrypoint.sh

# Script to wait db before launch flexisip [Licence Apache2]
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.2.1/wait /wait
RUN chmod +x /wait

ENTRYPOINT ["/flexisip-entrypoint.sh"]
CMD flexisip

上記Dockerfileから最新安定版flexisipをインストールしたイメージファイルを作成

$ docker build -f flex-from-ubuntu-apt-repo --pull --no-cache -t flex-from-ubuntu-apt-repo:22.04 --rm .

上記イメージからflexisipコンテナを起動

$ docker run -d --network host --name ubuntu-flexisip-repo flex-from-ubuntu-apt-repo:22.04 --server proxy