A TDLib compilation targeted to Linux and Node.js
85
Pre-compiled TDLib (Telegram Database Library) binaries for Alpine Linux. Optimized for Node.js applications using ffi-napi bindings.
FROM diegopher/tdlib-node-linux:1.8.58-alpine3.19 AS tdlib
FROM node:22-alpine
COPY --from=tdlib /tdlib/lib/libtdjson.so /app/tdlib/libtdjson.so
| Tag | TDLib Version | Base Image | Architecture |
|---|---|---|---|
1.8.58-alpine3.19 | 1.8.58 | Alpine 3.19 | linux/amd64 |
/tdlib/
└── lib/
└── libtdjson.so # TDLib JSON interface shared library
Your final image needs these Alpine packages:
RUN apk add --no-cache libstdc++ openssl zlib
Complete multi-stage Dockerfile for a Node.js Telegram application:
# Stage 1: TDLib binary
FROM diegopher/tdlib-node-linux:1.8.58-alpine3.19 AS tdlib
# Stage 2: Node.js dependencies
FROM node:22-alpine AS deps
RUN apk add --no-cache python3 make g++
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && pnpm install --frozen-lockfile
# Stage 3: Runtime
FROM node:22-alpine
RUN apk add --no-cache libstdc++ openssl zlib
WORKDIR /app
COPY --from=tdlib /tdlib/lib/libtdjson.so /app/tdlib/libtdjson.so
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ENV TDLIB_LIB_PATH=/app/tdlib/libtdjson.so
CMD ["node", "index.js"]
| Variable | Description | Example |
|---|---|---|
TDLIB_LIB_PATH | Path to libtdjson.so | /app/tdlib/libtdjson.so |
TDLIB_API_ID | Telegram API ID | 12345678 |
TDLIB_API_HASH | Telegram API Hash | abcdef123456... |
Get your API credentials at my.telegram.org.
To rebuild this image with a newer TDLib version:
git clone --depth 1 https://github.com/tdlib/td.git
docker build -t diegopher/tdlib-node-linux:VERSION-alpine3.19 -f - . <<'EOF'
FROM alpine:3.19
RUN apk add --no-cache alpine-sdk linux-headers git zlib-dev openssl-dev gperf cmake
WORKDIR /src
COPY td ./td
WORKDIR /src/td/build
RUN cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/tdlib .. \
&& cmake --build . --target install -j$(nproc)
EOF
TDLib is licensed under the terms of the Boost Software License. See TDLib License.
Content type
Image
Digest
sha256:6678e3d45…
Size
270.7 MB
Last updated
9 months ago
docker pull diegopher/tdlib-node-linux:1.8.58-alpine3.19