forked from TelegramMessenger/tgcalls
-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (41 loc) · 1.93 KB
/
Copy pathDockerfile
File metadata and controls
52 lines (41 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# syntax=docker/dockerfile:1
# Multi-stage build for tgcalls_cli Linux container
# Build: docker build -t tgcalls-test .
# Run: docker run tgcalls-test --mode reflector --reflector 91.108.13.2:598 --duration 10
# ============================================================
# Stage 1: Build
# ============================================================
FROM ubuntu:24.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc g++ cmake meson ninja-build nasm make \
autoconf automake libtool pkg-config python3 \
unzip curl ca-certificates patch \
zlib1g-dev libbz2-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
# Copy source tree
COPY . .
# Always download Bazel for the container's architecture (host copy may be wrong arch)
RUN ARCH=$(uname -m) && \
if [ "$ARCH" = "x86_64" ]; then BAZEL_ARCH="x86_64"; \
elif [ "$ARCH" = "aarch64" ]; then BAZEL_ARCH="arm64"; \
else echo "Unsupported arch: $ARCH" && exit 1; fi && \
curl -fL "https://github.com/bazelbuild/bazel/releases/download/8.4.2/bazel-8.4.2-linux-${BAZEL_ARCH}" \
-o build-input/bazel-8.4.2-linux && \
chmod +x build-input/bazel-8.4.2-linux
# Build with persistent Bazel cache
RUN --mount=type=cache,target=/root/.cache/bazel \
./build-input/bazel-8.4.2-linux build //submodules/TgVoipWebrtc/tgcalls/tools/cli:tgcalls_cli \
--strategy=Genrule=standalone --spawn_strategy=standalone && \
cp bazel-bin/submodules/TgVoipWebrtc/tgcalls/tools/cli/tgcalls_cli /tmp/tgcalls_cli
# ============================================================
# Stage 2: Runtime (minimal)
# ============================================================
FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /tmp/tgcalls_cli /usr/local/bin/tgcalls_cli
ENTRYPOINT ["tgcalls_cli"]
CMD ["--help"]