Ahmed Qais commited on
Commit
17e44cd
·
unverified ·
2 Parent(s): ac3964e0443b2f

Merge pull request #4 from AQSAMA/codex/fix-build-issues

Browse files

Use prebuilt aiogram/telegram-bot-api image instead of compiling TDLib in Docker

Files changed (2) hide show
  1. Dockerfile +2 -24
  2. README.md +4 -2
Dockerfile CHANGED
@@ -1,26 +1,4 @@
1
- FROM debian:bookworm-slim AS telegram-bot-api-builder
2
-
3
- ARG TELEGRAM_BOT_API_REF=0a9e5696ba149c99bedf972f040d2e28776a8a4f
4
-
5
- RUN apt-get update \
6
- && apt-get install -y --no-install-recommends \
7
- ca-certificates \
8
- cmake \
9
- g++ \
10
- gperf \
11
- git \
12
- make \
13
- libssl-dev \
14
- zlib1g-dev \
15
- && git init /src/telegram-bot-api \
16
- && git -C /src/telegram-bot-api remote add origin https://github.com/tdlib/telegram-bot-api.git \
17
- && git -C /src/telegram-bot-api fetch --depth 1 origin "${TELEGRAM_BOT_API_REF}" \
18
- && git -C /src/telegram-bot-api checkout --detach FETCH_HEAD \
19
- && git -C /src/telegram-bot-api submodule update --init --recursive --depth 1 \
20
- && cmake -S /src/telegram-bot-api -B /src/telegram-bot-api/build \
21
- -DCMAKE_BUILD_TYPE=Release \
22
- -DCMAKE_INSTALL_PREFIX=/usr/local \
23
- && cmake --build /src/telegram-bot-api/build --target install --parallel "$(nproc)"
24
 
25
  FROM python:3.12-slim AS runtime
26
 
@@ -44,7 +22,7 @@ RUN apt-get update \
44
 
45
  WORKDIR /app
46
 
47
- COPY --from=telegram-bot-api-builder /usr/local/bin/telegram-bot-api /usr/local/bin/telegram-bot-api
48
 
49
  COPY pyproject.toml README.md ./
50
  COPY telesave ./telesave
 
1
+ FROM aiogram/telegram-bot-api:10.1 AS telegram-bot-api
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  FROM python:3.12-slim AS runtime
4
 
 
22
 
23
  WORKDIR /app
24
 
25
+ COPY --from=telegram-bot-api /usr/local/bin/telegram-bot-api /usr/local/bin/telegram-bot-api
26
 
27
  COPY pyproject.toml README.md ./
28
  COPY telesave ./telesave
README.md CHANGED
@@ -12,7 +12,7 @@ TeleSave is an asynchronous Telegram download bot designed for Docker deployment
12
  - Async Telegram bot built with aiogram 3.
13
  - Broad social/media support through yt-dlp.
14
  - Direct HTTP/HTTPS streaming downloader for files.
15
- - Optional local Telegram Bot API server mode for uploads up to 2 GB.
16
  - Automatic Telegram send method selection for photos, videos, audio, voice, albums, and documents.
17
  - SSRF protection for direct download URLs.
18
  - Configurable file-size, timeout, and concurrency limits.
@@ -41,7 +41,9 @@ TELEGRAM_API_ID=your-api-id
41
  TELEGRAM_API_HASH=your-api-hash
42
  ```
43
 
44
- The Docker image builds and includes a local `telegram-bot-api` binary, and `docker/start.sh` starts it automatically when `TELEGRAM_LOCAL_MODE=true`. The Docker deployment defaults to this local mode so Hugging Face Spaces can upload files up to Telegram's 2 GB bot limit after you add `BOT_TOKEN`, `TELEGRAM_API_ID`, and `TELEGRAM_API_HASH` as Space secrets. For local development, `docker-compose.yml` runs the bot and a separate local Bot API service.
 
 
45
 
46
  For a public Hugging Face Space, never commit a real `.env` file. Add these values in **Settings → Variables and secrets → Secrets**:
47
 
 
12
  - Async Telegram bot built with aiogram 3.
13
  - Broad social/media support through yt-dlp.
14
  - Direct HTTP/HTTPS streaming downloader for files.
15
+ - Bundled local Telegram Bot API server mode for uploads up to 2 GB.
16
  - Automatic Telegram send method selection for photos, videos, audio, voice, albums, and documents.
17
  - SSRF protection for direct download URLs.
18
  - Configurable file-size, timeout, and concurrency limits.
 
41
  TELEGRAM_API_HASH=your-api-hash
42
  ```
43
 
44
+ The Docker image copies a ready-to-use `telegram-bot-api` binary from the `aiogram/telegram-bot-api` image instead of compiling TDLib from source. This keeps Hugging Face Spaces builds fast while preserving the original local Bot API functionality for uploads up to Telegram's 2 GB bot limit.
45
+
46
+ `docker/start.sh` starts the bundled local Bot API server automatically when `TELEGRAM_LOCAL_MODE=true` and `TELEGRAM_API_BASE_URL` points at `127.0.0.1` or `localhost`. For local development, `docker-compose.yml` can still run the bot and a separate local Bot API service.
47
 
48
  For a public Hugging Face Space, never commit a real `.env` file. Add these values in **Settings → Variables and secrets → Secrets**:
49