From 70cc5cfe99f744e178b31e3b632983f0e3a69940 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Sun, 27 Dec 2020 17:26:00 +0000 Subject: [PATCH] Initial commit --- .github/workflows/build_image.yml | 35 +++++++++++++++++++++++++++++++ Dockerfile | 11 ++++++++++ README.md | 23 ++++++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 .github/workflows/build_image.yml create mode 100644 Dockerfile create mode 100644 README.md diff --git a/.github/workflows/build_image.yml b/.github/workflows/build_image.yml new file mode 100644 index 0000000..05328f6 --- /dev/null +++ b/.github/workflows/build_image.yml @@ -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" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3fc52aa --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..4e75b49 --- /dev/null +++ b/README.md @@ -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. \ No newline at end of file