Skip to content

Commit fd6514d

Browse files
Docker build FROM ubuntu 22.04
1 parent b126571 commit fd6514d

4 files changed

Lines changed: 242 additions & 43 deletions

File tree

.dockerignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2026 LiveKit
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Rust build output (huge; rebuilt inside image)
16+
client-sdk-rust/target/
17+
18+
# Git and IDE
19+
.git
20+
.gitignore
21+
.gitmodules
22+
.cursor
23+
.vscode
24+
*.swp
25+
*~
26+
27+
# Build outputs and caches
28+
build/
29+
*.log
30+
__pycache__/
31+
32+
# Docker
33+
Dockerfile
34+
.dockerignore
35+
36+
# Docs and misc (optional; uncomment if you never need these in the image)
37+
# README.md
38+
# *.md

.github/workflows/builds.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,29 @@ on:
77
- src/**
88
- include/**
99
- examples/**
10+
- bridge/**
1011
- client-sdk-rust/**
1112
- CMakeLists.txt
1213
- build.sh
1314
- build.cmd
1415
- vcpkg.json
1516
- CMakePresets.json
17+
- docker/Dockerfile
1618
- .github/workflows/**
1719
pull_request:
1820
branches: ["main"]
1921
paths:
2022
- src/**
2123
- include/**
2224
- examples/**
25+
- bridge/**
2326
- client-sdk-rust/**
2427
- CMakeLists.txt
2528
- build.sh
2629
- build.cmd
2730
- vcpkg.json
2831
- CMakePresets.json
32+
- docker/Dockerfile
2933
- .github/workflows/**
3034
workflow_dispatch:
3135

@@ -246,3 +250,25 @@ jobs:
246250
else
247251
./build.sh clean-all || true
248252
fi
253+
254+
docker-build:
255+
name: Build (docker-linux-x64)
256+
runs-on: ubuntu-latest
257+
258+
steps:
259+
- name: Checkout (with submodules)
260+
uses: actions/checkout@v4
261+
with:
262+
submodules: recursive
263+
fetch-depth: 0
264+
265+
- name: Set up Docker Buildx
266+
uses: docker/setup-buildx-action@v3
267+
268+
- name: Build Docker image
269+
run: docker build -t livekit-cpp-sdk:${{ github.sha }} . -f docker/Dockerfile
270+
271+
- name: Build SDK inside Docker
272+
run: |
273+
docker run --rm livekit-cpp-sdk:${{ github.sha }} bash -c \
274+
'cd /client-sdk-cpp && chmod +x build.sh && ./build.sh release-examples'

README.md

Lines changed: 55 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,7 @@
1414
Use this SDK to add realtime video, audio and data features to your C++ app. By connecting to <a href="https://livekit.io/">LiveKit</a> Cloud or a self-hosted server, you can quickly build applications such as multi-modal AI, live streaming, or video calls with just a few lines of code.
1515
<!--END_DESCRIPTION-->
1616

17-
## Build & Installation Guide
18-
19-
This page covers how to build and install the LiveKit C++ Client SDK for real-time audio/video communication.
20-
21-
---
22-
23-
### 📦 Requirements
17+
## 📦 Requirements
2418
- **CMake** ≥ 3.20
2519
- **Rust / Cargo** (latest stable toolchain)
2620
- **Git LFS** (required for examples)
@@ -31,19 +25,19 @@ This page covers how to build and install the LiveKit C++ Client SDK for real-ti
3125

3226
**Platform-Specific Requirements:**
3327

34-
#### For Building the SDK:
28+
### For Building the SDK:
3529
- **Windows:** Visual Studio 2019+, vcpkg
3630
- **Linux:** `sudo apt install libprotobuf-dev libssl-dev` (protobuf 3.x)
3731
- **macOS:** `brew install protobuf` (protobuf 3.x)
3832

39-
#### For Using the Pre-built SDK:
33+
### For Using the Pre-built SDK:
4034
- **Windows:** ✅ All dependencies included (DLLs bundled) - ready to use
4135
- **Linux:** ⚠️ Requires `libprotobuf` and `libssl-dev`; deploy `liblivekit_ffi.so` with your executable
4236
- **macOS:** ⚠️ Requires `protobuf`; deploy `liblivekit_ffi.dylib` with your executable
4337

4438
> **Note**: If the SDK was built with Protobuf 6.0+, you also need `libabsl-dev` (Linux) or `abseil` (macOS).
4539
46-
### 🧩 Clone the Repository
40+
## 🧩 Clone the Repository
4741

4842
Make sure to initialize the Rust submodule (`client-sdk-rust`):
4943

@@ -57,9 +51,9 @@ cd client-sdk-cpp
5751
git submodule update --init --recursive
5852
```
5953

60-
### ⚙️ BUILD
54+
## ⚙️ BUILD
6155

62-
#### Quick Build (Using Build Scripts)
56+
### Quick Build (Using Build Scripts)
6357

6458
**Linux/macOS:**
6559
```bash
@@ -71,6 +65,17 @@ git submodule update --init --recursive
7165
./build.sh release-tests # Build Release with tests
7266
```
7367
**Windows**
68+
Using build scripts:
69+
```powershell
70+
.\build.cmd clean # Clean CMake build artifacts
71+
.\build.cmd clean-all # Deep clean (C++ + Rust + generated files)
72+
.\build.cmd debug # Build Debug version
73+
.\build.cmd release # Build Release version
74+
.\build.cmd debug-tests # Build Debug with tests
75+
.\build.cmd release-tests # Build Release with tests
76+
```
77+
78+
### Windows build using cmake/vcpkg
7479
```bash
7580
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="$PWD/vcpkg/scripts/buildsystems/vcpkg.cmake" # Generate Makefiles in build folder
7681
# Build (Release or Debug)
@@ -86,17 +91,7 @@ You must install protobuf via vcpkg (so CMake can find ProtobufConfig.cmake and
8691
.\vcpkg\vcpkg install protobuf:x64-windows
8792
```
8893

89-
**Windows:**
90-
```powershell
91-
.\build.cmd clean # Clean CMake build artifacts
92-
.\build.cmd clean-all # Deep clean (C++ + Rust + generated files)
93-
.\build.cmd debug # Build Debug version
94-
.\build.cmd release # Build Release version
95-
.\build.cmd debug-tests # Build Debug with tests
96-
.\build.cmd release-tests # Build Release with tests
97-
```
98-
99-
#### Advanced Build (Using CMake Presets)
94+
### Advanced Build (Using CMake Presets)
10095

10196
For more control and platform-specific builds, see the detailed instructions in [README_BUILD.md](README_BUILD.md).
10297

@@ -128,15 +123,32 @@ cmake --build --preset macos-release
128123

129124
📖 **For complete build instructions, troubleshooting, and platform-specific notes, see [README_BUILD.md](README_BUILD.md)**
130125

131-
### 🧪 Run Example
126+
### Building with Docker
127+
The Dockerfile COPYs folders/files required to build the CPP SDK into the image.
128+
**NOTE:** this has only been tested on Linux
129+
```bash
130+
docker build -t livekit-cpp-sdk . -f docker/Dockerfile
131+
docker run -it --network host livekit-cpp-sdk:latest bash
132+
```
133+
134+
__NOTE:__ if you are building your own Dockerfile, you will likely need to set the same `ENV` variables as in `docker/Dockerfile`, but to the relevant directories:
135+
```bash
136+
export CC=$HOME/gcc-14/bin/gcc
137+
export CXX=$HOME/gcc-14/bin/g++
138+
export LD_LIBRARY_PATH=$HOME/gcc-14/lib64:$LD_LIBRARY_PATH
139+
export PATH=$HOME/.cargo/bin:$PATH
140+
export PATH=$HOME/cmake-3.31/bin:$PATH
141+
```
142+
143+
## 🧪 Run Example
132144

133145
### Generate Tokens
134146
Before running any participant, create JWT tokens with the proper identity and room name, example
135147
```bash
136148
lk token create -r test -i your_own_identity --join --valid-for 99999h --dev --room=your_own_room
137149
```
138150

139-
#### SimpleRoom
151+
### SimpleRoom
140152

141153
```bash
142154
./build/examples/SimpleRoom --url $URL --token <jwt-token>
@@ -164,23 +176,23 @@ If the E2EE keys do not match between participants:
164176

165177
Press Ctrl-C to exit the example.
166178

167-
#### SimpleRpc
179+
### SimpleRpc
168180
The SimpleRpc example demonstrates how to:
169181
- Connect multiple participants to the same LiveKit room
170182
- Register RPC handlers (e.g., arrival, square-root, divide, long-calculation)
171183
- Send RPC requests from one participant to another
172184
- Handle success, application errors, unsupported methods, and timeouts
173185
- Observe round-trip times (RTT) for each RPC call
174186

175-
##### 🔑 Generate Tokens
187+
#### 🔑 Generate Tokens
176188
Before running any participant, create JWT tokens with **caller**, **greeter** and **math-genius** identities and room name.
177189
```bash
178190
lk token create -r test -i caller --join --valid-for 99999h --dev --room=your_own_room
179191
lk token create -r test -i greeter --join --valid-for 99999h --dev --room=your_own_room
180192
lk token create -r test -i math-genius --join --valid-for 99999h --dev --room=your_own_room
181193
```
182194

183-
##### ▶ Start Participants
195+
#### ▶ Start Participants
184196
Every participant is run as a separate terminal process, note --role needs to match the token identity.
185197
```bash
186198
./build/examples/SimpleRpc --url $URL --token <jwt-token> --role=math-genius
@@ -191,7 +203,7 @@ The caller will automatically:
191203
- Print round-trip times
192204
- Annotate expected successes or expected failures
193205

194-
#### SimpleDataStream
206+
### SimpleDataStream
195207
- The SimpleDataStream example demonstrates how to:
196208
- Connect multiple participants to the same LiveKit room
197209
- Register text stream and byte stream handlers by topic (e.g. "chat", "files")
@@ -201,14 +213,14 @@ The caller will automatically:
201213
- Measure and print one-way latency on the receiver using sender timestamps
202214
- Receive streamed chunks and reconstruct the full payload on the receiver
203215

204-
##### 🔑 Generate Tokens
216+
#### 🔑 Generate Tokens
205217
Before running any participant, create JWT tokens with caller and greeter identities and your room name.
206218
```bash
207219
lk token create -r test -i caller --join --valid-for 99999h --dev --room=your_own_room
208220
lk token create -r test -i greeter --join --valid-for 99999h --dev --room=your_own_room
209221
```
210222

211-
##### ▶ Start Participants
223+
#### ▶ Start Participants
212224
Start the receiver first (so it registers stream handlers before messages arrive):
213225
```bash
214226
./build/examples/SimpleDataStream --url $URL --token <jwt-token>
@@ -312,7 +324,7 @@ and a **ROS2 bridge** that maps `LogLevel` to `RCLCPP_*` macros.
312324

313325
---
314326

315-
### 🧪 Integration & Stress Tests
327+
## 🧪 Integration & Stress Tests
316328

317329
The SDK includes integration and stress tests using Google Test (gtest).
318330

@@ -330,7 +342,7 @@ The SDK includes integration and stress tests using Google Test (gtest).
330342
.\build.cmd release-tests
331343
```
332344

333-
#### Run Tests
345+
### Run Tests
334346

335347
After building, run tests using ctest or directly:
336348

@@ -348,7 +360,7 @@ ctest --output-on-failure
348360
./build-debug/bin/livekit_stress_tests --gtest_filter="*MaxPayloadStress*"
349361
```
350362

351-
#### Test Types
363+
### Test Types
352364

353365
| Executable | Description |
354366
|------------|-------------|
@@ -376,29 +388,29 @@ lk token create -r test -i rpc-caller --join --valid-for 99999h --dev --room=rpc
376388
lk token create -r test -i rpc-receiver --join --valid-for 99999h --dev --room=rpc-test-room
377389
```
378390

379-
#### Test Coverage
391+
### Test Coverage
380392

381393
- **SDK Initialization**: Initialize/shutdown lifecycle
382394
- **Room**: Room creation, options, connection
383395
- **Audio Frame**: Frame creation, manipulation, edge cases
384396
- **RPC**: Round-trip calls, max payload (15KB), timeouts, errors, concurrent calls
385397
- **Stress Tests**: High throughput, bidirectional RPC, memory pressure
386398

387-
### 🧰 Recommended Setup
388-
#### macOS
399+
## 🧰 Recommended Setup
400+
### macOS
389401
```bash
390402
brew install cmake protobuf rust
391403
```
392404

393-
#### Ubuntu / Debian
405+
### Ubuntu / Debian
394406
```bash
395407
sudo apt update
396408
sudo apt install -y cmake protobuf-compiler build-essential
397409
curl https://sh.rustup.rs -sSf | sh
398410
```
399411

400-
### 🛠️ Development Tips
401-
#### Update Rust version
412+
## 🛠️ Development Tips
413+
### Update Rust version
402414
```bash
403415
cd client-sdk-cpp
404416
git fetch origin
@@ -417,19 +429,19 @@ git -C client-sdk-rust/yuv-sys submodule update --init --recursive --checkout
417429
git submodule status --recursive
418430
```
419431

420-
#### If yuv-sys fails to build
432+
### If yuv-sys fails to build
421433
```bash
422434
cargo clean -p yuv-sys
423435
cargo build -p yuv-sys -vv
424436
```
425437

426-
#### Full clean (Rust + C++ build folders)
438+
### Full clean (Rust + C++ build folders)
427439
In some cases, you may need to perform a full clean that deletes all build artifacts from both the Rust and C++ folders:
428440
```bash
429441
./build.sh clean-all
430442
```
431443

432-
#### Clang format
444+
### Clang format
433445
CPP SDK is using clang C++ format
434446
```bash
435447
brew install clang-format

0 commit comments

Comments
 (0)