Sign inSign up

uoziod/tdlib

By uoziod

Updated about 1 year ago

TDLib (Telegram Database Library) in Docker. Use it with your language of choice!

Image
Developer tools
4

3.1K

uoziod/tdlib repository overview

TDLib

Docker image of TDLib (Telegram Database Library).

Source code

Source code and pipelines that build this image: https://gitlab.com/uoziod/tdlib

Image build process

Library being built in a separate image and later moved in another image (so the source code and the build tools are left behind). This guarantees that the environment it's built in is very much the same as the runtime and resulting image size is slim. Built library is located in /usr/local/tdlib and this path is added to LD_LIBRARY_PATH environment variable so the library is accessible system-wide.

Usage examples

The library itself is system agnostic, you can use it with a framework of your choice (like go-tdlib or tdl).

Dockerfile for a TDLib app on golang:

FROM uoziod/tdlib:1.8.22_alpine-3.19

# Install Go
RUN apk add --no-cache go

# Set the working directory in the container
WORKDIR /app

# Copy the Go mod and sum files
COPY go.mod go.sum ./

# Download all dependencies
RUN go mod download

# Copy the source code into the container
COPY . .

# Build the Go app
RUN go build -o main .

# Command to run the executable
CMD ["./main"]

Dockerfile for a TDLib app on NodeJS:

FROM uoziod/tdlib:1.8.22_alpine-3.19

# Install NodeJS
RUN apk add --update nodejs npm

# Cache node_modules
ADD package.json /tmp/package.json
RUN cd /tmp && npm i
RUN mkdir -p /opt/app && cp -a /tmp/node_modules /opt/app/

# Copy app files
WORKDIR /opt/app
ADD . /opt/app

# Start the app
CMD ["npm", "start"]

Tag summary

Content type

Image

Digest

sha256:5c3535437

Size

17 MB

Last updated

about 1 year ago

docker pull uoziod/tdlib:1.8.51_alpine-3.19