Skip to content

Commit 895558e

Browse files
CI docker build arm image, docker build example collection on linux arm/x64
1 parent 905cca7 commit 895558e

File tree

2 files changed

+131
-4
lines changed

2 files changed

+131
-4
lines changed

.github/workflows/builds.yml

Lines changed: 113 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ on:
3333
- .github/workflows/**
3434
workflow_dispatch:
3535

36+
permissions:
37+
contents: read
38+
3639
env:
3740
CARGO_TERM_COLOR: always
3841
# vcpkg binary caching for Windows
@@ -252,7 +255,7 @@ jobs:
252255
./build.sh clean-all || true
253256
fi
254257
255-
docker-build:
258+
docker-build-x64:
256259
name: Build (docker-linux-x64)
257260
runs-on: ubuntu-latest
258261

@@ -267,9 +270,115 @@ jobs:
267270
uses: docker/setup-buildx-action@v3
268271

269272
- name: Build Docker image
270-
run: docker build -t livekit-cpp-sdk:${{ github.sha }} . -f docker/Dockerfile
273+
run: |
274+
docker buildx build \
275+
--platform linux/amd64 \
276+
--load \
277+
-t livekit-cpp-sdk-x64:${{ github.sha }} \
278+
. \
279+
-f docker/Dockerfile
280+
281+
- name: Verify installed SDK inside image
282+
run: |
283+
docker run --rm livekit-cpp-sdk-x64:${{ github.sha }} bash -c \
284+
'test -f /opt/livekit-sdk/lib/cmake/LiveKit/LiveKitConfig.cmake'
271285
272-
- name: Build SDK inside Docker
286+
- name: Save Docker image artifact
287+
run: |
288+
docker save livekit-cpp-sdk-x64:${{ github.sha }} | gzip > livekit-cpp-sdk-x64.tar.gz
289+
290+
- name: Upload Docker image artifact
291+
uses: actions/upload-artifact@v4
292+
with:
293+
name: livekit-cpp-sdk-docker-x64
294+
path: livekit-cpp-sdk-x64.tar.gz
295+
retention-days: 7
296+
297+
docker-build-linux-arm64:
298+
name: Build (docker-linux-arm64)
299+
runs-on: ubuntu-24.04-arm
300+
301+
steps:
302+
- name: Checkout (with submodules)
303+
uses: actions/checkout@v4
304+
with:
305+
submodules: recursive
306+
fetch-depth: 0
307+
308+
- name: Set up Docker Buildx
309+
uses: docker/setup-buildx-action@v3
310+
311+
- name: Build Docker image
312+
run: |
313+
docker buildx build \
314+
--platform linux/arm64 \
315+
--load \
316+
-t livekit-cpp-sdk:${{ github.sha }} \
317+
. \
318+
-f docker/Dockerfile
319+
320+
- name: Verify installed SDK inside image
273321
run: |
274322
docker run --rm livekit-cpp-sdk:${{ github.sha }} bash -c \
275-
'cd /client-sdk-cpp && chmod +x build.sh && ./build.sh release-examples'
323+
'test -f /opt/livekit-sdk/lib/cmake/LiveKit/LiveKitConfig.cmake'
324+
325+
- name: Save Docker image artifact
326+
run: |
327+
docker save livekit-cpp-sdk:${{ github.sha }} | gzip > livekit-cpp-sdk-arm64.tar.gz
328+
329+
- name: Upload Docker image artifact
330+
uses: actions/upload-artifact@v4
331+
with:
332+
name: livekit-cpp-sdk-docker-arm64
333+
path: livekit-cpp-sdk-arm64.tar.gz
334+
retention-days: 7
335+
336+
build-collections-linux-arm64:
337+
name: Build (cpp-example-collection-linux-arm64)
338+
runs-on: ubuntu-24.04-arm
339+
needs: docker-build-linux-arm64
340+
341+
steps:
342+
- name: Download Docker image artifact
343+
uses: actions/download-artifact@v4
344+
with:
345+
name: livekit-cpp-sdk-docker-arm64
346+
347+
- name: Load Docker image
348+
run: gzip -dc livekit-cpp-sdk-arm64.tar.gz | docker load
349+
350+
- name: Build cpp-example-collection against installed SDK
351+
run: |
352+
docker run --rm livekit-cpp-sdk:${{ github.sha }} bash -lc '
353+
set -euxo pipefail
354+
git clone https://github.com/livekit-examples/cpp-example-collection.git /tmp/cpp-example-collection
355+
cd /tmp/cpp-example-collection
356+
git checkout sderosa/examples-migration
357+
cmake -S . -B build -DLIVEKIT_LOCAL_SDK_DIR=/opt/livekit-sdk
358+
cmake --build build --parallel
359+
'
360+
361+
build-collections-x64:
362+
name: Build (cpp-example-collection-x64)
363+
runs-on: ubuntu-latest
364+
needs: docker-build-x64
365+
366+
steps:
367+
- name: Download Docker image artifact
368+
uses: actions/download-artifact@v4
369+
with:
370+
name: livekit-cpp-sdk-docker-x64
371+
372+
- name: Load Docker image
373+
run: gzip -dc livekit-cpp-sdk-x64.tar.gz | docker load
374+
375+
- name: Build cpp-example-collection against installed SDK
376+
run: |
377+
docker run --rm livekit-cpp-sdk-x64:${{ github.sha }} bash -lc '
378+
set -euxo pipefail
379+
git clone https://github.com/livekit-examples/cpp-example-collection.git /tmp/cpp-example-collection
380+
cd /tmp/cpp-example-collection
381+
git checkout sderosa/examples-migration
382+
cmake -S . -B build -DLIVEKIT_LOCAL_SDK_DIR=/opt/livekit-sdk
383+
cmake --build build --parallel
384+
'

docker/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,33 @@ FROM ubuntu:22.04
2222

2323
ENV DEBIAN_FRONTEND=noninteractive
2424
ENV HOME=/root
25+
ENV SDK_INSTALL_PREFIX=/opt/livekit-sdk
2526

2627
# Install make, pkg-config, and base build deps (pkg-config + libglib2.0-dev for Rust glib-sys, libasound2-dev for alsa-sys)
2728
RUN apt-get update && apt-get install -y --no-install-recommends \
2829
ca-certificates \
2930
curl \
3031
git \
3132
libasound2-dev \
33+
libabsl-dev \
3234
libclang-dev \
3335
libdrm-dev \
3436
libglib2.0-dev \
37+
libprotobuf-dev \
38+
libdecor-0-dev \
3539
libspdlog-dev \
3640
libssl-dev \
3741
libunwind-dev \
3842
libusb-1.0-0-dev \
3943
libva-dev \
44+
libwayland-dev \
4045
make \
4146
ninja-build \
4247
pkg-config \
48+
protobuf-compiler \
4349
wget \
50+
llvm-dev \
51+
clang \
4452
xz-utils \
4553
&& rm -rf /var/lib/apt/lists/*
4654

@@ -122,3 +130,13 @@ RUN mkdir -p /client-sdk-cpp/client-sdk-rust/.cargo \
122130
&& printf '%s\n' '[target.x86_64-unknown-linux-gnu]' 'linker = "/root/gcc-14/bin/g++"' \
123131
'[target.aarch64-unknown-linux-gnu]' 'linker = "/root/gcc-14/bin/g++"' > /client-sdk-cpp/client-sdk-rust/.cargo/config.toml
124132

133+
# Build and install the SDK into a fixed prefix so downstream projects can
134+
# consume the image as a prebuilt LiveKit SDK environment.
135+
RUN LLVM_VERSION="$(llvm-config --version | cut -d. -f1)" \
136+
&& export LIBCLANG_PATH="/usr/lib/llvm-${LLVM_VERSION}/lib" \
137+
&& export CXXFLAGS="-Wno-deprecated-declarations" \
138+
&& export CFLAGS="-Wno-deprecated-declarations" \
139+
&& chmod +x /client-sdk-cpp/build.sh \
140+
&& cd /client-sdk-cpp \
141+
&& ./build.sh release --bundle --prefix "${SDK_INSTALL_PREFIX}" \
142+
&& test -f "${SDK_INSTALL_PREFIX}/lib/cmake/LiveKit/LiveKitConfig.cmake"

0 commit comments

Comments
 (0)