Sign inSign up

diegopher/tdlib-node-linux

By diegopher

Updated 9 months ago

A TDLib compilation targeted to Linux and Node.js

Image
Languages & frameworks
API management
0

85

diegopher/tdlib-node-linux repository overview

TDLib Pre-built for Alpine Linux

Pre-compiled TDLib (Telegram Database Library) binaries for Alpine Linux. Optimized for Node.js applications using ffi-napi bindings.

Quick Start

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

Available Tags

TagTDLib VersionBase ImageArchitecture
1.8.58-alpine3.191.8.58Alpine 3.19linux/amd64

What's Included

/tdlib/
└── lib/
    └── libtdjson.so    # TDLib JSON interface shared library

Runtime Dependencies

Your final image needs these Alpine packages:

RUN apk add --no-cache libstdc++ openssl zlib

Usage Example

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"]

Environment Variables

VariableDescriptionExample
TDLIB_LIB_PATHPath to libtdjson.so/app/tdlib/libtdjson.so
TDLIB_API_IDTelegram API ID12345678
TDLIB_API_HASHTelegram API Hashabcdef123456...

Get your API credentials at my.telegram.org.

Building from Source

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

License

TDLib is licensed under the terms of the Boost Software License. See TDLib License.

Tag summary

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