Feature multi distro (#4)

This commit is contained in:
Infactum 2018-11-21 22:35:36 +05:00 committed by GitHub
parent 36d2e4cb89
commit 56d1cfd225
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 79 additions and 18 deletions

View File

@ -10,8 +10,10 @@ Your SIP PBX should be comaptible with `L16@48000` or `OPUS@48000` voice codec.
## Usage ## Usage
1. [Download](https://ci.appveyor.com/api/projects/Infactum/tg2sip/artifacts/tg2sip.zip?branch=master) prebuild version from CI or compile it yourself. 1. Download prebuild versions for supported OS from CI or compile it yourself.
Prebuild binaries have been tested in Ubuntu 18.04 Bionic and require `libopus0` package installed. [Ubuntu 18.04 Bionic](https://ci.appveyor.com/api/projects/Infactum/tg2sip/artifacts/tg2sip_bionic.zip?branch=master&job=Environment%3A%20target_name%3DUbuntu%20Bionic%2C%20docker_tag%3Dbionic)
[CentOS 7](https://ci.appveyor.com/api/projects/Infactum/tg2sip/artifacts/tg2sip_centos7.zip?branch=master&job=Environment%3A%20target_name%3DUbuntu%20Bionic%2C%20docker_tag%3Dcentos7)
Prebuild binaries requires OPUS libraries (`libopus0` for Ubuntu, `opus` for CentOS, etc).
2. Obtain `api_id` and `api_hash` tokens from [this](https://my.telegram.org) page and put them in `settings.ini` file. 2. Obtain `api_id` and `api_hash` tokens from [this](https://my.telegram.org) page and put them in `settings.ini` file.
3. Login into telegram with `gen_db` app 3. Login into telegram with `gen_db` app
4. Set SIP server settings in `settings.ini` 4. Set SIP server settings in `settings.ini`

View File

@ -1,32 +1,41 @@
version: 1.0.0+{build} version: 1.0.0+{build}
image: image:
- Ubuntu - Previous Ubuntu
services:
- docker
configuration: Release configuration: Release
platform: x64 platform: x64
environment: environment:
DOCKER_LOGIN: infactum global:
DOCKER_PASSWORD: docker_login: infactum
secure: wWPsUiEtw8rfnjX2/Y3/AA== docker_password:
DOCKER_IMAGE: infactum/tg2sip-builder secure: wWPsUiEtw8rfnjX2/Y3/AA==
docker_image: infactum/tg2sip-builder
matrix: matrix:
- TARGET_PLATFORM: x64 - target_name: Ubuntu Bionic
docker_tag: bionic
- target_name: CentOS 7
docker_tag: centos7
init: init:
- sh: | - sh: |
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD docker login -u "$docker_login" -p "$docker_password"
docker pull $DOCKER_IMAGE docker pull "$docker_image":"$docker_tag"
install:
- sh: docker build buildenv/ --cache-from $DOCKER_IMAGE -t $DOCKER_IMAGE:latest install:
- sh: docker build buildenv/ -f buildenv/Dockerfile."$docker_tag" --cache-from "$docker_image":"$docker_tag" -t "$docker_image":"$docker_tag"
build_script: build_script:
- sh: >- - sh: >-
mkdir build; mkdir build;
docker run --rm -v $(pwd):/src $DOCKER_IMAGE /bin/bash -c " docker run --rm -v "$(pwd)":/src "$docker_image" /bin/bash -c "
mkdir build && cd build; mkdir build && cd build;
cmake -DCMAKE_BUILD_TYPE=Release /src; cmake -DCMAKE_BUILD_TYPE=Release /src;
cmake --build .; cmake --build .;
@ -37,8 +46,5 @@ build_script:
7z a tg2sip.zip ./build/tg2sip ./build/gen_db ./settings.ini; 7z a tg2sip.zip ./build/tg2sip ./build/gen_db ./settings.ini;
after_build: after_build:
- sh: docker push $DOCKER_IMAGE - sh: docker push "$docker_image":"$docker_tag"
- sh: appveyor PushArtifact tg2sip.zip -FileName tg2sip_"$docker_tag".zip -DeploymentName "TG2SIP $target_name"
artifacts:
- path: tg2sip.zip
name: TG2SIP Ubuntu Bionic

View File

@ -0,0 +1,53 @@
FROM centos:7 as builder
# https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/
RUN yum -y install centos-release-scl yum-utils \
&& yum-config-manager --enable rhel-server-rhscl-7-rpms \
&& yum install -y devtoolset-7-gcc devtoolset-7-gcc-c++
RUN yum install -y \
make \
git wget \
zlib-devel opus-devel openssl-devel gperf \
pkgconfig ccache gperf unzip
RUN wget https://cmake.org/files/v3.9/cmake-3.9.6-Linux-x86_64.sh \
&& sh cmake-3.9.6-Linux-x86_64.sh --prefix=/usr --exclude-subdir
COPY tdlib_header.patch /
COPY tdlib_threadname.patch /
RUN source /opt/rh/devtoolset-7/enable \
&& git clone https://github.com/tdlib/td.git \
&& cd td \
&& git reset --hard v1.2.0 \
&& git apply /tdlib_header.patch \
&& git apply /tdlib_threadname.patch \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& cmake --build . --target install \
&& cd / \
&& rm -rf td
COPY config_site.h /
RUN source /opt/rh/devtoolset-7/enable \
&& git clone https://github.com/Infactum/pjproject.git \
&& cd pjproject \
&& cp /config_site.h pjlib/include/pj \
&& ./configure --disable-sound CFLAGS="-O3 -DNDEBUG" \
&& make dep && make && make install \
&& cd / \
&& rm -rf pjproject
RUN source /opt/rh/devtoolset-7/enable \
&& git clone -n https://github.com/gabime/spdlog.git \
&& cd spdlog \
&& git checkout tags/v0.17.0 \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release -DSPDLOG_BUILD_EXAMPLES=OFF -DSPDLOG_BUILD_TESTING=OFF .. \
&& cmake --build . --target install \
&& cd / \
&& rm -rf spdlog