proxy / Dockerfile
no-name-here's picture
Update Dockerfile
e5175c8 verified
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# ── Build dependencies ────────────────────────────────────────────────────────
RUN apt-get update && apt-get install -y \
cmake \
g++ \
git \
libssl-dev \
zlib1g-dev \
gperf \
make \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# ── Clone and build the official Telegram Bot API server ─────────────────────
# Pin to a specific commit for reproducibility
RUN git clone --recursive https://github.com/tdlib/telegram-bot-api.git /tmp/telegram-bot-api
WORKDIR /tmp/telegram-bot-api
RUN mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX:PATH=/usr/local \
.. && \
cmake --build . --target install -j$(nproc)
# ── Runtime setup ─────────────────────────────────────────────────────────────
RUN mkdir -p /data /var/log/telegram-bot-api
# HuggingFace Spaces requires the app to run as a non-root user
RUN useradd -m -u 1000 botapi && \
chown -R botapi:botapi /data /var/log/telegram-bot-api
USER botapi
# HF Spaces exposes port 7860
EXPOSE 7860
# ── Entrypoint ────────────────────────────────────────────────────────────────
# API_ID and API_HASH must be set as HF Space secrets
CMD telegram-bot-api \
--api-id=${API_ID} \
--api-hash=${API_HASH} \
--http-port=7860 \
--dir=/data \
--temp-dir=/data/temp \
--log=/var/log/telegram-bot-api/server.log \
--verbosity=1