A lightweight and up-to-date Docker image for the Telegram Database Library (TDLib).
Compiling TDLib from source can be incredibly resource-intensive (often requiring lots of RAM and taking a long time). This repository automates the build process via GitHub Actions, providing you with ready-to-use, pre-compiled TDLib binaries inside a Docker container.
- Pre-compiled & Ready to Use: Skip the long compilation times.
- Automated Builds: Keeps up to date with the latest TDLib releases via GitHub Actions.
- Multi-Stage Build Friendly: Easily copy the built binaries into your own application's Docker image (Python, Node.js, Go, PHP, etc.).
- Optimized Size: Built to keep the final image footprint as small as possible.
You can pull the latest built image directly from Docker Hub (or GitHub Container Registry, depending on your setup):
docker pull airani/tdlib:latest
You can use this image as a base for your own Telegram bots or clients.
FROM airani/tdlib:latest
# Set your working directory
WORKDIR /app
# Copy your bot code
COPY . .
# Run your application (Example for a Python wrapper)
CMD ["python3", "main.py"]
If you only need the compiled .so (shared object) files to keep your final image minimal, use a multi-stage build to copy the binaries into your preferred runtime environment:
# Stage 1: Get TDLib from the pre-built image
FROM airani/tdlib:latest AS tdlib
# Stage 2: Your actual application environment (e.g., Python, Node.js)
FROM python:3.10-slim
# Copy the compiled TDLib binary from the first stage
# (Adjust the source path depending on where it is built in the Dockerfile)
COPY --from=tdlib /usr/local/lib/libtdjson.so /usr/local/lib/libtdjson.so
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python3", "bot.py"]
If you want to build the Docker image yourself on your local machine:
- Clone the repository:
git clone https://github.com/airani/tdlib.git
cd tdlib
- Build the Docker image:
docker build -t airani/tdlib:local .
(Note: Ensure your Docker daemon has access to at least 4GB to 8GB of RAM, as g++ compilation for TDLib is highly memory-intensive.)
Contributions, issues, and feature requests are welcome! Feel free to check the issues page if you want to contribute.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information. Note that TDLib itself is licensed under the Boost Software License.
Maintained by airani