Skip to content

Repository files navigation

docker-python-telegram-bot

CI

A minimal, container-ready python-telegram-bot (v21, async) starter. Bring your token, write your handlers in bot.py.

Quick start

  1. Create a bot and copy its token from @BotFather.

  2. Put the token in a .env file next to docker-compose.yml:

    TELEGRAM_TOKEN=123456:your-token
  3. Build & run:

    docker compose up --build

The token is read at runtime only (never baked into the image), and .env is git-ignored.

Try it

In Telegram, open your bot and send /hello — it replies Hello <your first name>.

Develop

Add your handlers in bot.py (async, python-telegram-bot v21 API):

python -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
TELEGRAM_TOKEN=… python bot.py

Tooling

  • Lint/format: ruffruff check & ruff format --check.
  • Dockerfile lint: hadolint.
  • Both run in CI (.github/workflows/ci.yml).
  • Pinned base image (python:3.12-alpine) and dependency (python-telegram-bot[all]~=21.0).

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages