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

**URL:** <https://forum.ficusonline.com/t/topic/489>\
**Category:** Server\
**Created:** [2023 年 8 月 24 日午前 1:58 UTC](https://forum.ficusonline.com/t/topic/489 "2023-08-24T01:58:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tk-fuse](https://forum.ficusonline.com/user_avatar/forum.ficusonline.com/tk-fuse/32/255_2.png) [@tk-fuse](https://forum.ficusonline.com/u/tk-fuse)\
**Post date:** [2023 年 8 月 24 日午前 1:58 UTC](https://forum.ficusonline.com/t/topic/489/1 "2023-08-24T01:58:50Z")

</div>

[https://gitlab.linphone.org/BC/public/flexisip/-/tree/master/docker](https://gitlab.linphone.org/BC/public/flexisip/-/tree/master/docker)

> **[flexisip/docker at master · BelledonneCommunications/flexisip](https://github.com/BelledonneCommunications/flexisip/tree/master/docker)**
>
> Linphone.org mirror for flexisip (git://git.linphone.org/flexisip.git) - BelledonneCommunications/flexisip

 ![Screenshot from 2023-08-24 20-39-16](https://forum.ficusonline.com/uploads/default/original/2X/c/c6baaca527b3ce0ef25b2cec76ea30ed5c21ac99.png)

 ![Screenshot from 2023-08-24 12-34-17](https://forum.ficusonline.com/uploads/default/original/2X/a/a46b4abc372e2e776042c75670bc5e6c44470304.png)

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

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

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

```auto
$ 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ソースディレクトリで実行)

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

```

コンテナ内でビルド

```auto
# 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)**。

> **[1. Installation - XWiki](https://wiki.linphone.org/xwiki/wiki/public/view/Flexisip/1.%20Installation/)**
>
> 1. Installation

`flex-from-ubuntu-apt-repo`

```auto
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をインストールしたイメージファイルを作成

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

```

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

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

```
