FICUSONLINE F9E
linphone-sdk : Docker Image (Ubuntu20.04)
Pre-build the Docker image of linphone-sdk, which is required when building Linphone or Flexisip from source.
Takanobu FuseAdministrator

5 min read

3 years ago

Linux

Dockerfile for Ubuntu 20.04 is not provided, so create a new one based on the dockerfile for Ubuntu 18.04.

Docker Linphone Sdk Block 2

GitLab linphone-sdk

1. Download linphone-sdk

All you need is only a docker-files directory for creating linphone-sdk docker image on Ubuntu 20.04.

Copy and paste the docker-files directory to any location, then delete the downloaded linphone-sdk.

Download Source Code from GitLab

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

2. Create Dockerfile

Create the dockerfile:bc-dev-ubuntu-20-04-lts by copying the dockerfile:bc-dev-ubuntu-18-04-lts in the dcoker-files directory.

Changed or added points from bc-dev-ubuntu-18-04-lts are as follows.

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. Edit Makefile

Added the build section for the above dockerfile in Makefile.

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

4. Build linphone-sdk Image

Build linphone-sdk image for Ubuntu20.04

$ make ubuntu-20.04-LTS

Check the created image

$ 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. Start linphone-sdk Container

Run linphone-sdk container from the above image

$ 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:~$ 

You will be able to build each app for Ubuntu 20.04 by importing the source code such as Linphone or Flexisip into the running container.

Next time, I will summarize how to build the desktop version of Linphone and Flexisip that runs on Ubuntu 20.04 using the above linphone-sdk container.

I will follow the same topic on the forum site for supplements and corrections to this article.