|
| 1 | +# Linux build environment for client-sdk-cpp. |
| 2 | +# Ubuntu packages match the Linux jobs in .github/workflows/builds.yml, |
| 3 | +# tests.yml, and make-release.yml. Pass --build-arg INSTALL_GSTREAMER=1 to also |
| 4 | +# install the GStreamer packages from .github/actions/setup-capture. |
| 5 | +# The source tree is bind-mounted at /work. |
| 6 | +FROM ubuntu:24.04 |
| 7 | + |
| 8 | +ARG DEBIAN_FRONTEND=noninteractive |
| 9 | +# Empty means the default version in install-clang.sh. |
| 10 | +ARG LLVM_VERSION |
| 11 | + |
| 12 | +# ca-certificates, curl, git, git-lfs, xz-utils, sudo, and python3 are already |
| 13 | +# present on GitHub-hosted runners. python3 is what the coverage job uses for |
| 14 | +# gcovr. git is needed because FetchContent clones GoogleTest. |
| 15 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 16 | + ca-certificates curl git rsync xz-utils \ |
| 17 | + python3 \ |
| 18 | + build-essential cmake ninja-build pkg-config \ |
| 19 | + llvm-dev libclang-dev clang \ |
| 20 | + libva-dev libdrm-dev libgbm-dev libx11-dev libgl1-mesa-dev \ |
| 21 | + libxext-dev libxcomposite-dev libxdamage-dev libxfixes-dev \ |
| 22 | + libxrandr-dev libxi-dev libxkbcommon-dev \ |
| 23 | + libasound2-dev libpulse-dev \ |
| 24 | + libssl-dev \ |
| 25 | + libprotobuf-dev protobuf-compiler \ |
| 26 | + libabsl-dev \ |
| 27 | + libcurl4-openssl-dev \ |
| 28 | + libwayland-dev libdecor-0-dev \ |
| 29 | + libunwind-dev libjpeg-dev \ |
| 30 | + gdb jq \ |
| 31 | + && rm -rf /var/lib/apt/lists/* |
| 32 | + |
| 33 | +# webrtc-sys needs a recent clang for the hermetic libc++ in libwebrtc. Use the |
| 34 | +# same script as CI. The build context is the repository root, and |
| 35 | +# linux-build.Dockerfile.dockerignore limits it to this one file. |
| 36 | +COPY client-sdk-rust/.github/scripts/install-clang.sh /tmp/install-clang.sh |
| 37 | +RUN LLVM_ROOT=/opt/llvm /tmp/install-clang.sh \ |
| 38 | + && rm /tmp/install-clang.sh |
| 39 | + |
| 40 | +ENV CC=/opt/llvm/bin/clang \ |
| 41 | + CXX=/opt/llvm/bin/clang++ \ |
| 42 | + LIBCLANG_PATH=/opt/llvm/lib \ |
| 43 | + RUSTUP_HOME=/opt/rustup \ |
| 44 | + CARGO_HOME=/opt/cargo \ |
| 45 | + PATH=/opt/cargo/bin:$PATH |
| 46 | + |
| 47 | +RUN curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable \ |
| 48 | + && chmod -R a+rwX /opt/rustup /opt/cargo \ |
| 49 | + && cargo --version |
| 50 | + |
| 51 | +# Keep Rust outputs out of the synced source tree. |
| 52 | +ENV CARGO_TARGET_DIR=/cargo-target |
| 53 | + |
| 54 | +# Last install so a GStreamer toggle reuses the toolchain layers above. |
| 55 | +# libunwind-dev is already in the base package list. |
| 56 | +ARG INSTALL_GSTREAMER=0 |
| 57 | +RUN if [ "$INSTALL_GSTREAMER" = "1" ]; then \ |
| 58 | + apt-get update && apt-get install -y --no-install-recommends \ |
| 59 | + libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ |
| 60 | + gstreamer1.0-plugins-base gstreamer1.0-plugins-good \ |
| 61 | + gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav \ |
| 62 | + && rm -rf /var/lib/apt/lists/*; \ |
| 63 | + fi |
| 64 | + |
| 65 | +WORKDIR /work |
| 66 | +CMD ["bash"] |
0 commit comments