|
3 | 3 | # Image: ghcr.io/ankuper/telegram-bot-api |
4 | 4 | # |
5 | 5 | # Build args let CI pin exact refs. |
6 | | -ARG TELEPROTO3_REF=main |
| 6 | +# TELEPROTO3_REF = a teleproto3 RELEASE/TAG (policy: consume the prebuilt artifact, |
| 7 | +# never build teleproto3 from source). Pin to a tag, not a branch. |
| 8 | +ARG TELEPROTO3_REF=lib-v0.8.0 |
7 | 9 | ARG TDLIB_REF=teleproto3-support |
8 | 10 | ARG BOT_API_REF=master |
9 | 11 |
|
10 | 12 | # ─── Build stage ────────────────────────────────────────────────────────────── |
11 | 13 | FROM ubuntu:24.04 AS builder |
12 | 14 | ENV DEBIAN_FRONTEND=noninteractive |
13 | 15 | RUN apt-get update && apt-get install -y --no-install-recommends \ |
14 | | - cmake g++ make git zlib1g-dev libssl-dev gperf ca-certificates \ |
| 16 | + cmake g++ make git zlib1g-dev libssl-dev gperf ca-certificates curl \ |
15 | 17 | && rm -rf /var/lib/apt/lists/* |
16 | 18 |
|
17 | | -# 1) libteleproto3 (Type3 client lib) — Option B: build from source, no release artifacts yet. |
| 19 | +# 1) libteleproto3 (Type3 client lib) — PREBUILT from the teleproto3 release/tag. |
| 20 | +# Policy (docs/release-and-branch-policy.md): never build teleproto3 from source; |
| 21 | +# consume the published per-platform artifact. Linux server → libteleproto3-linux-<arch>.tar.gz |
| 22 | +# (archive layout: lib/{libteleproto3.a,include/}). |
18 | 23 | ARG TELEPROTO3_REF |
19 | | -RUN git clone --depth 1 --branch "${TELEPROTO3_REF}" \ |
20 | | - https://github.com/ankuper/teleproto3.git /teleproto3 \ |
21 | | - && cmake -S /teleproto3/lib -B /teleproto3/lib/build -DCMAKE_BUILD_TYPE=Release \ |
22 | | - && cmake --build /teleproto3/lib/build -j"$(nproc)" \ |
23 | | - && cp /teleproto3/lib/build/libteleproto3.a /usr/local/lib/libteleproto3.a \ |
24 | | - && cp /teleproto3/lib/include/t3.h /usr/local/include/t3.h |
| 24 | +RUN ARCH="$(uname -m)" \ |
| 25 | + && curl -fsSL "https://github.com/ankuper/teleproto3/releases/download/${TELEPROTO3_REF}/libteleproto3-linux-${ARCH}.tar.gz" \ |
| 26 | + -o /tmp/libteleproto3.tar.gz \ |
| 27 | + && mkdir -p /teleproto3 && tar xzf /tmp/libteleproto3.tar.gz -C /teleproto3 \ |
| 28 | + && cp /teleproto3/lib/libteleproto3.a /usr/local/lib/libteleproto3.a \ |
| 29 | + && cp -r /teleproto3/lib/include/. /usr/local/include/ |
25 | 30 |
|
26 | 31 | # 2) telegram-bot-api with our Type3-patched TDLib swapped in for the td/ submodule. |
27 | 32 | ARG BOT_API_REF |
|
0 commit comments