Skip to content

perf: optimize OpenCV static build caching for QEMU docker builds#40

Merged
Vladush merged 1 commit intomasterfrom
perf/docker-opencv-caching
Apr 20, 2026
Merged

perf: optimize OpenCV static build caching for QEMU docker builds#40
Vladush merged 1 commit intomasterfrom
perf/docker-opencv-caching

Conversation

@Vladush
Copy link
Copy Markdown
Owner

@Vladush Vladush commented Apr 20, 2026

Description

This PR fixes an issue where the OpenCV static library was being built from scratch on every run for riscv64 and i386 QEMU Docker builds. Because the debian:sid base image digest updates frequently, GitHub Docker registry layer caching was constantly invalidated.

Changes introduced:

  • Added actions/cache steps to the i386 and riscv64 CI jobs to cache opencv_static directly on the GitHub host runner.
  • Updated docker/Dockerfile.i386 and docker/Dockerfile.riscv64 to seamlessly move the cached opencv_static folder during the build process, bypassing the ~2 hours cross-compilation step.
  • Included an rm -rf ./opencv_static_cached pre-extraction step to ensure robust caching behavior without nested directory artifacts across cache hits.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement (CI)

How Has This Been Tested?

  • Simulated Docker layer caching miss to verify the script properly checks for the /app/opencv_static/lib/libopencv_core.a file.
  • Validated Dockerfile COPY commands correctly pick up the cached artifacts without breaking local non-CI docker builds (due to .dockerignore settings remaining intact).

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@Vladush Vladush merged commit e3a1c8a into master Apr 20, 2026
6 checks passed
@Vladush Vladush deleted the perf/docker-opencv-caching branch April 20, 2026 20:21
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.

1 participant