Plug-and-play Telegram Bot API server. Alpine based, cross-compiled for amd64, arm64, arm/v7.
1.9K
The solo purpose of this package is to provide the most hands-free experience of running your own Telegram Bot API server.
Official source: https://github.com/tdlib/telegram-bot-api.
docker compose (recommended)NOTE: If you don't have Telegram app API keys, you could get them at https://core.telegram.org/api/obtaining_api_id.
NOTE: These commands include
sudo, you might need to replace/delete it depending on your system.
git clone https://github.com/heilkit/telegram-bot-api && cd telegram-bot-api.env file.USER_ID="$(id -u)" GROUP_ID="$(id -g)" sudo docker compose up -dAlternatively you could use a "one-liner":
git clone https://github.com/heilkit/telegram-bot-api &&
cd telegram-bot-api &&
"${EDITOR:-nano}" .env &&
USER_ID="$(id -u)" GROUP_ID="$(id -g)" sudo docker compose up -d
git clone https://github.com/heilkit/telegram-bot-api && cd telegram-bot-api/var/lib/telegram-bot-api (replace it with something custom, if you wish, but make
sure it matches the -d argument of telegram-bot-api).sudo setfacl -m u:$(id -u):rwx -R /var/lib/telegram-bot-api.sudo STORAGE=/var/lib/telegram-bot-api docker run --name telegram-bot-api -u "$(id -u):$(id -g)" --restart=always -v $STORAGE:$STORAGE -d heilkit/telegram-bot-api -d $STORAGE -v 1 --local --api-id=<API_ID> --api-hash=<API_HASH>compose.yaml example# Why compose.yaml is so complicated?
# Because of Docker file permission nuances, and your bots wanting to be able to access your local telegram-bot-api's files.
#
# Recommended command to run this (unless you've defined $USER_ID & $GROUP_ID in your ENV):
# USER_ID="$(id -u)" GROUP_ID="$(id -g)" sudo docker compose up -d
services:
telegram-bot-api:
image: heilkit/telegram-bot-api:latest
command: -d "${STORAGE}" -v 1 --local --api-id="${API_ID}" --api-hash="${API_HASH}"
restart: on-failure:10
depends_on:
telegram-bot-api-prelude:
condition: service_completed_successfully
env_file:
- .env
user: ${USER_ID}:${GROUP_ID}
ports:
- ${PORT}:8081
volumes:
- ${STORAGE}:${STORAGE}
environment:
- API_ID
- API_HASH
- PORT
- STORAGE
- USER_ID
- GROUP_ID
# This could be moved into a separated image, but I don't think it's necessary hence
# telegram-bot-api wouldn't get restated too often and this image weights only 10MB. So, KISS.
telegram-bot-api-prelude:
image: alpine:latest
entrypoint: apk add --update --no-cache acl && setfacl -m u:${USER_ID}:rwx -R ${STORAGE}
volumes:
- ${STORAGE}:${STORAGE}
Content type
Image
Digest
sha256:6e5634c16…
Size
16 MB
Last updated
over 2 years ago
docker pull heilkit/telegram-bot-api