[Question] docker image
folt opened this issue ยท 9 comments
Is there an official telegram-bot-api image for docker?
Are there any plans to develop it?
thanks for answers
No. See #9 (comment).
No. See #9 (comment).
This clarifies the situation.
Maybe you should document this strategy in the documentation?
It is strange to document lack of official support of a third-party tool, even it is so popular as Docker.
I managed to build the 54mb docker image with the API server using alpine linux.
Disadvantages:
- Building docker image requires at least 6GB of RAM
- Build on 4 CPU + 6GB of RAM takes ~1200 seconds
Pros:
- Thanks to the multistep build I was able to decrease size from 560MB to 54MB
Will test it for few days and either create PR with Dockerfile or push the image somewhere for everyone to use after I'll set up the build pipeline to sync with changes in this repo :)
Update: Well.. There you have it everyone - freshly baked, minimal docker image for the telegram api server.
- Instructions are in the README
- I will add cross compiled version for the Raspberry Pi, possibly after the dinner ๐
https://github.com/lukaszraczylo/tdlib-telegram-bot-api-docker
Update: As I have raspberry pi k8s cluster as well - I decided to add images for the Raspberry Pi / ARM64 as well, then stumbled upon few comments of people requesting them.
Just an example of telegram-bot-api
Dockerfile, 56 MB:
FROM alpine:3.19 as builder
# Compile telegram-bot-api server:
RUN apk update && apk upgrade && \
apk add --update alpine-sdk linux-headers git zlib-dev openssl-dev gperf cmake && \
git clone --recursive https://github.com/tdlib/telegram-bot-api.git && \
cd telegram-bot-api && \
rm -rf build && \
mkdir build && \
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local .. && \
cmake --build . --target install
FROM alpine:3.19
# Install dependencies:
RUN apk update && apk upgrade && apk add --update --no-cache \
zlib-dev openssl-dev libstdc++
# Install telegram-bot-api server:
COPY --from=builder /usr/local/bin/telegram-bot-api /usr/local/bin/
ENTRYPOINT ["telegram-bot-api", "--api-id=${TELEGRAM_API_ID}", "--api-hash=${TELEGRAM_API_HASH}", "--http-port=8080", "--local"]