Skip to content

docker base image for faster builds#92

Open
stephen-derosa wants to merge 1 commit intolivekit:mainfrom
stephen-derosa:sderosa/docker-base-for-faster-builds
Open

docker base image for faster builds#92
stephen-derosa wants to merge 1 commit intolivekit:mainfrom
stephen-derosa:sderosa/docker-base-for-faster-builds

Conversation

@stephen-derosa
Copy link
Copy Markdown
Contributor

@stephen-derosa stephen-derosa commented Apr 10, 2026

Breakout Dockerfile into .base and .sdk docker files. They build the base and sdk respectively.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a split Docker build (base image + SDK image) to improve build times via better layer caching, and adds GitHub Actions workflows to publish and validate multi-arch Docker images on main.

Changes:

  • Add docker/Dockerfile.sdk and refactor docker/Dockerfile.base to be a reusable build-deps base layer.
  • Add workflows to publish multi-arch base/SDK images to GHCR and validate the published SDK image by building cpp-example-collection.
  • Update the existing CI workflow to build using the new base+SDK Dockerfiles on pull requests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
docker/Dockerfile.sdk New Dockerfile that builds & installs the SDK on top of a prebuilt base image.
docker/Dockerfile.base Removes SDK build steps to make this a reusable dependency base image.
.github/workflows/docker-images.yml New workflow to build/push base + SDK images and publish multi-arch manifests.
.github/workflows/docker-validate.yml New workflow to validate the published SDK image after docker-images completes.
.github/workflows/builds.yml Updates PR CI to build using the new base+SDK Docker image flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

fi

case "${path}" in
docker/Dockerfile.sdk|src/*|include/*|bridge/*|client-sdk-rust/*|cmake/*|data/*|CMakeLists.txt|build.sh|build.cmd|build.h.in|CMakePresets.json)
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change-detection glob patterns only match single-level paths (e.g., include/*), but this repo has nested paths like include/livekit/... and src/tests/.... As written, sdk_changed can remain false even when relevant files change, causing the workflow to conclude successfully without publishing an image (and then downstream validation/pulls will fail). Consider switching to prefix checks (e.g., [[ "$path" == include/* ]] with globstar, or case patterns like include/**|src/**|... after shopt -s globstar) so nested paths are handled.

Suggested change
docker/Dockerfile.sdk|src/*|include/*|bridge/*|client-sdk-rust/*|cmake/*|data/*|CMakeLists.txt|build.sh|build.cmd|build.h.in|CMakePresets.json)
docker/Dockerfile.sdk|src/*|src/*/*|include/*|include/*/*|bridge/*|bridge/*/*|client-sdk-rust/*|client-sdk-rust/*/*|cmake/*|cmake/*/*|data/*|data/*/*|CMakeLists.txt|build.sh|build.cmd|build.h.in|CMakePresets.json)

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +19
on:
push:
branches: ["main"]
paths:
- src/**
- include/**
- bridge/**
- client-sdk-rust/**
- CMakeLists.txt
- build.sh
- build.cmd
- build.h.in
- CMakePresets.json
- cmake/**
- data/**
- docker/Dockerfile.base
- docker/Dockerfile.sdk
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow only builds/publishes images when the Dockerfile or selected inputs change, and there is no scheduled rebuild. That means the published base image may go stale and miss upstream security updates from ubuntu:22.04 and apt packages. Consider adding a schedule trigger (and/or workflow_dispatch) that periodically rebuilds at least the base image so consumers get patched dependencies.

Copilot uses AI. Check for mistakes.
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Build base Docker image
run: |
docker build \
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker/Dockerfile.base relies on the BuildKit-provided TARGETARCH ARG to download the correct CMake installer. This job switched from docker buildx build --platform ... to plain docker build without explicitly setting TARGETARCH, which can be empty if BuildKit isn't enabled, leading to an invalid CMake download URL and a failing CI build. Consider using docker buildx build --platform linux/amd64 --load again, or explicitly providing --build-arg TARGETARCH=amd64 (or computing the arch inside the Dockerfile via dpkg --print-architecture).

Suggested change
docker build \
docker build \
--build-arg TARGETARCH=amd64 \

Copilot uses AI. Check for mistakes.
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Build base Docker image
run: |
docker build \
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as the x64 job: docker/Dockerfile.base expects TARGETARCH to be set for the CMake download logic, but this uses plain docker build and doesn't pass TARGETARCH. If BuildKit isn't enabled on the runner, TARGETARCH will be empty and the build will fail. Consider using docker buildx build --platform linux/arm64 --load or passing --build-arg TARGETARCH=arm64.

Suggested change
docker build \
docker build \
--build-arg TARGETARCH=arm64 \

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants