Skip to content

Add Docker image and multi-arch CI build - #893

Open
yagop wants to merge 1 commit into
tdlib:masterfrom
yagop:docker-multiarch
Open

Add Docker image and multi-arch CI build#893
yagop wants to merge 1 commit into
tdlib:masterfrom
yagop:docker-multiarch

Conversation

@yagop

@yagop yagop commented Aug 25, 2026

Copy link
Copy Markdown

Adds an official Dockerfile and a GitHub Actions workflow that builds and publishes a multi-arch container image.

Dockerfile

  • Multi-stage build on debian:13-slim.
    • Build stage installs the toolchain (g++, cmake, ninja-build, gperf, libssl-dev, zlib1g-dev, ccache) and builds with -DCMAKE_BUILD_TYPE=Release. A BuildKit cache mount keeps the ccache directory warm between builds.
    • Runtime stage carries only the server binary plus the shared libraries it links against (ca-certificates, openssl, zlib1g), keeping the final image small.
  • The server binary is the image ENTRYPOINT; the default CMD runs with --verbosity=2 --temp-dir=/tmp/telegram-bot-api. The API id/hash are supplied at runtime via TELEGRAM_API_ID / TELEGRAM_API_HASH or flags.

CI workflow (.github/workflows/docker.yml)

  • Builds linux/amd64 and linux/arm64 natively on their respective GitHub-hosted runners (ubuntu-24.04 and ubuntu-24.04-arm) rather than under QEMU emulation, which matters a lot for a from-source C++ build.
  • Each platform is pushed to GHCR by digest; a final merge job assembles the per-arch digests into a single multi-arch manifest and tags it (branch, tag, and sha).
  • Uses GitHub Actions layer cache (type=gha, scoped per platform). On pull_request the image is built but not pushed.

The image is published to ghcr.io/${{ github.repository }}.

@yagop
yagop force-pushed the docker-multiarch branch 2 times, most recently from 8135cb9 to 02c67b4 Compare August 25, 2026 14:46
Multi-stage build on debian:13-slim: a build stage with ccache and Ninja,
a slim runtime stage with only the shared libraries the server links against.
The server binary is the image ENTRYPOINT.

The Docker workflow builds linux/amd64 and linux/arm64 natively on their
respective GitHub-hosted runners, pushes each by digest to GHCR, and merges
them into a single multi-arch manifest.
@yagop
yagop force-pushed the docker-multiarch branch from 02c67b4 to fd9824d Compare August 25, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant