Telegram local bot API server as a docker container
169
The Telegram Bot API provides an HTTP API for creating Telegram Bots.
Official code repository https://github.com/tdlib/telegram-bot-api
Dockerfile & image build manual here https://git.bearns.me/didinst/tg-bot-api-docker
Manteined builds for linux os, amd64 and arm/v7 arch
Get you own application api id and hash on https://my.telegram.org
Put it into tg-bot-api.env file:
TELEGRAM_API_ID=
TELEGRAM_API_HASH=
Then run docker run -d -p <host port>:8081 --name <you container name> --env-file=./tg-bot-api.env bearns/tg-bot-api-server
Local Telegram Bot API server will started on <host port> port.
FROM alpine:latest
RUN apk update && apk --no-cache upgrade \
&& apk add --no-cache openssl-dev linux-headers zlib-dev gcc gperf cmake build-base git libstdc++ \
&& git clone --recursive https://github.com/tdlib/telegram-bot-api.git \
&& cd telegram-bot-api \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release .. \
&& cmake --build . -j 4 --target install \
&& apk del linux-headers gcc gperf cmake build-base git \
&& cd ../.. \
&& rm -r ./telegram-bot-api
RUN adduser --no-create-home --uid 2000 --disabled-password tg-bot \
&& mkdir -p /opt/telegram-bot-api \
&& chown tg-bot /opt/telegram-bot-api
ENV TELEGRAM_API_ID=""
ENV TELEGRAM_API_HASH=""
EXPOSE 8081/tcp
USER tg-bot
ENTRYPOINT ["/usr/local/bin/telegram-bot-api", "--local", "--dir=/opt/telegram-bot-api"]
Content type
Image
Digest
Size
14.5 MB
Last updated
over 4 years ago
docker pull bearns/tg-bot-api-server:3