FICUSONLINE F9E
linphone-sdk : Dockerイメージ (Ubuntu20.04)
LinphoneやFlexisipをビルドする際に必要なlinphone-sdkのDockerイメージを事前にビルドします。
Takanobu FuseAdministrator

4 min read

3 years ago

Linux

Ubuntu 20.04版Dockerfileは提供されていないため、Ubuntu18.04版Dockerfileをベースに新規作成します。

Docker Linphone Sdk Block 2

GitLab linphone-sdk

1. linphone-sdkソースのダウンロード

必要なのは、 Ubuntu20.04 ベースのlinphone-sdk に必要なパッケージをインストールしたイメージファイル作成のための docker-files ディレクトリのみです。
docker-files ディレクトリを任意の場所にコピーペースト後、ダウンロードした linphone-sdk は削除して下さい。

ソースのダウンロード

$ git clone https://gitlab.linphone.org/BC/public/linphone-sdk.git

2. Dockerfileの作成

dcoker-files ディレクトリ内で bc-dev-ubuntu-18-04-lts をコピーし bc-dev-ubuntu-20-04-lts を作成します。

bc-dev-ubuntu-18-04-lts からの変更・追加箇所は以下の通りです。

bc-dev-ubuntu-20-04-lts

FROM ubuntu:20.04

MAINTAINER Ghislain MARY < [email protected]>

# Use a french mirror
RUN sed -i -E 's/(archive|security)\.ubuntu\.com/fr.archive.ubuntu.com/' /etc/apt/sources.list

# Configure locale
RUN apt-get update && \
    apt-get install -y locales && \
    apt-get clean && \
    echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
    locale-gen
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'

ENV SHELL=/bin/bash
ENV PS1='\[\e[33m\]\[email protected]>\[\e[0m\] '
# For the problem is tzdata, which stops with the interactive dialog
ENV DEBIAN_FRONTEND=noninteractive

# Install common general tools
RUN apt-get update && \
    apt-get install -y nano sudo vim && \
    apt-get clean

# Install development tools
RUN apt-get update && \
    apt-get install -y alien at autoconf bison ccache clang cmake doxygen elfutils g++ gdb git graphviz intltool libtool lsb-release make nasm ninja-build openssh-client patch yasm && \
    apt-get clean

# Install linphone dependencies development packages
RUN apt-get update && \
    apt-get install -y libasound2-dev libavcodec-dev libavutil-dev libbsd-dev libegl1-mesa-dev libglew-dev libgsm1-dev libmariadb-dev-compat libmbedtls-dev libopus-dev libpq-dev libpulse-dev libqt5svg5-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libsrtp2-dev libssl-dev libswscale-dev libturbojpeg0-dev libv4l-dev libvpx-dev libxerces-c-dev libxml2-dev libxv-dev qt3d5-dev qt5-default qtbase5-dev qtbase5-dev-tools qtconnectivity5-dev qtdeclarative5-dev qtdeclarative5-dev-tools qtdeclarative5-dev-tools qtquickcontrols2-5-dev qttools5-dev qttools5-dev-tools xsdcxx && \
    apt-get clean

# Install CMake 3.21
RUN curl -o cmake.tar.gz https://cmake.org/files/v3.21/cmake-3.21.3.tar.gz && \
    tar xvzf cmake.tar.gz && rm cmake.tar.gz && cd cmake-3.21.3 && cmake . && make -j5 install && cd .. && rm -rf cmake-3.21.3

# Configure user bc
RUN useradd -ms /bin/bash bc && \
    echo 'bc:cotcot' | chpasswd && \
    echo 'bc ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

# Switch for 'bc' user
USER bc
WORKDIR /home/bc

# Install python3 and python modules.
# This must be done as 'bc' user because some python modules are installed into /usr/local/lib when pip is invoked
# as root, and rpmbuild prevent python from seaching its modules in this prefix. Using 'bc' user make the python
# modules to be installed into /home/bc/.local/lib.
RUN curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py && \
    sudo apt-get install -y python2 python3-pip && sudo apt-get clean -y && \
    sudo ln -s /usr/bin/python2.7 /usr/bin/python && \
    sudo python2 get-pip.py
# Run the below command after "docker run" in /home/bc    
#    pip install --user six pystache graphviz && \
#    pip3 install --user six pystache graphviz

COPY --chown=bc rpmmacros /home/bc/.rpmmacros
CMD bash

3. Makefileの編集

Makefileに上記dockerfileイメージのビルドセクションを追加します。

ubuntu-20.04-LTS:
	docker build -f bc-dev-ubuntu-20-04-lts -t $(BASE_NAME)/bc-dev-ubuntu:20.04 --rm .

4. linphone-sdkイメージのビルド

Ubuntu20.04版linphone-sdk イメージをビルドします。

$ make ubuntu-20.04-LTS

作成イメージの確認

$ docker images
REPOSITORY                                                      TAG       IMAGE ID       CREATED         SIZE
gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-ubuntu   20.04     88d9f4a2c038   9 minutes ago   2.52GB
ubuntu                                                          20.04     597ce1600cf4   3 days ago      72.8MB

5. linphone-sdkコンテナの起動

上記イメージからlinphone-sdkコンテナ起動

$ docker run --name linphone-desktop -v $PWD:/home/bc -it gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-ubuntu:20.04

bc@410eda0ead5c:~$ 

起動したコンテナ内にLinphoneFlexisipなどのソースコードを取り込んで、Ubuntu20.04向けに各アプリのビルドが出来るようなります。

次回は上記linphone-sdkコンテナを利用した、Ubuntu 20.04上で動作するデスクトップ版LinphoneFlexisipのビルド方法について纏めます。

本記事についての補足・訂正等はフォーラムでフォローします。