Initial commit

This commit is contained in:
Lukasz Raczylo 2020-12-27 17:26:00 +00:00 committed by Lukasz Raczylo
commit 70cc5cfe99
No known key found for this signature in database
GPG Key ID: 4C68D09621D47E6B
3 changed files with 69 additions and 0 deletions

35
.github/workflows/build_image.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: Build Telegram API server
on:
workflow_dispatch
jobs:
build:
runs-on: ubuntu-20.04
name: Clone telegram api server repo
steps:
- name: Checkout API repo
uses: actions/checkout@v2
with:
repository: 'tdlib/telegram-bot-api'
path: '/home/runner/work/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api'
- name: Checkout Dockerfile
uses: actions/checkout@v2
with:
repository: 'lukaszraczylo/tdlib-telegram-bot-api-docker'
path: '/home/runner/work/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api-docker/docker'
- name: Apply Dockerfile
run: |
cp /home/runner/work/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api-docker/docker/Dockerfile /home/runner/work/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api/Dockerfile
- name: Get release sha and run number
id: get_sha
run: |
echo "GITHUB_SHA=$(echo ${GITHUB_SHA::8})" >> $GITHUB_ENV
echo "GITHUB_RUN_ID=$(echo ${GITHUB_RUN_NUMBER})" >> $GITHUB_ENV
- name: Build Docker image
run: |
cd /home/runner/work/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api-docker/tdlib-telegram-bot-api
export SET_DOCKER_REGISTRY="docker.pkg.github.com"
export BASE_IMG_NAME="$SET_DOCKER_REGISTRY/lukaszraczylo/tdlib-telegram-bot-api-docker/telegram-api-server"
docker login $SET_DOCKER_REGISTRY -u "${{ github.actor }}" -p "${{ secrets.GITHUB_TOKEN }}"
docker build -t $BASE_IMG_NAME:${{ env.GITHUB_SHA }} -t $BASE_IMG_NAME:1.0.${{ env.GITHUB_RUN_ID }} -t $BASE_IMG_NAME:latest .
docker push "$BASE_IMG_NAME"
docker push "$BASE_IMG_NAME:latest"

11
Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM alpine:latest as buildBase
RUN apk add --no-cache alpine-sdk linux-headers git zlib-dev openssl-dev gperf php cmake
ADD . /srv
WORKDIR /srv
RUN git submodule update --init --recursive && mkdir -p build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../tdlib -DCMAKE_BUILD_TYPE=Release ..
RUN cd /srv/build && cmake --build . --target install
FROM alpine:latest
RUN apk add --no-cache zlib-dev openssl-dev libstdc++
COPY --from=buildBase /srv/build/telegram-bot-api /srv/telegram-bot-api
ENTRYPOINT ["/srv/telegram-bot-api"]

23
README.md Normal file
View File

@ -0,0 +1,23 @@
# tdlib-telegram-bot-api-docker
## Purpose of the project
Produce working, minimal Docker image for the Telegram Bot API server together with easy
to use pipeline generating builds on the changes within the main repository managed by
Telegram team.
## How to use the image
### Docker version
```
docker pull docker.pkg.github.com/lukaszraczylo/tdlib-telegram-bot-api-docker/telegram-api-server:latest
docker run -p 8081:8081 -e TELEGRAM_API_ID=yourApiID -e TELEGRAM_API_HASH=yourApiHash -t docker.pkg.github.com/lukaszraczylo/tdlib-telegram-bot-api-docker/telegram-api-server
```
### Kubernetes version
TBC;
## TODO
- Provide shorter link for the pulls. Honestly.