no-name-here commited on
Commit
cf41a36
Β·
verified Β·
1 Parent(s): 9d60f43

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +52 -0
Dockerfile ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:22.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+
5
+ # ── Build dependencies ────────────────────────────────────────────────────────
6
+ RUN apt-get update && apt-get install -y \
7
+ cmake \
8
+ g++ \
9
+ git \
10
+ libssl-dev \
11
+ zlib1g-dev \
12
+ gperf \
13
+ libgperf-dev \
14
+ make \
15
+ curl \
16
+ ca-certificates \
17
+ && rm -rf /var/lib/apt/lists/*
18
+
19
+ # ── Clone and build the official Telegram Bot API server ─────────────────────
20
+ # Pin to a specific commit for reproducibility
21
+ RUN git clone --recursive https://github.com/tdlib/telegram-bot-api.git /tmp/telegram-bot-api
22
+
23
+ WORKDIR /tmp/telegram-bot-api
24
+
25
+ RUN mkdir build && cd build && \
26
+ cmake -DCMAKE_BUILD_TYPE=Release \
27
+ -DCMAKE_INSTALL_PREFIX:PATH=/usr/local \
28
+ .. && \
29
+ cmake --build . --target install -j$(nproc)
30
+
31
+ # ── Runtime setup ─────────────────────────────────────────────────────────────
32
+ RUN mkdir -p /data /var/log/telegram-bot-api
33
+
34
+ # HuggingFace Spaces requires the app to run as a non-root user
35
+ RUN useradd -m -u 1000 botapi && \
36
+ chown -R botapi:botapi /data /var/log/telegram-bot-api
37
+
38
+ USER botapi
39
+
40
+ # HF Spaces exposes port 7860
41
+ EXPOSE 7860
42
+
43
+ # ── Entrypoint ────────────────────────────────────────────────────────────────
44
+ # API_ID and API_HASH must be set as HF Space secrets
45
+ CMD telegram-bot-api \
46
+ --api-id=${API_ID} \
47
+ --api-hash=${API_HASH} \
48
+ --http-port=7860 \
49
+ --dir=/data \
50
+ --temp-dir=/data/temp \
51
+ --log=/var/log/telegram-bot-api/server.log \
52
+ --verbosity=1