Skip to content

Modernize Docker packaging: drop stale images, fix untested test stages - #1995

Merged
shimat merged 3 commits into
mainfrom
chore/modernize-docker-images
Jul 3, 2026
Merged

shimat merged 3 commits into
mainfrom
chore/modernize-docker-images

Conversation

@shimat

@shimat shimat commented Jul 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Delete Dockerfiles for EOL runtimes (.NET 5/6, .NET Core 3.1, Amazon Linux Lambda, App Engine aspnetcore 3.1) that aren't referenced by any CI workflow — they were only generating Renovate PR noise on dead files.
  • Delete the superseded ubuntu24-dotnet10-opencv4.13.0 (+-slim) images now that main targets OpenCV 5.
  • Point docker-deploy.yml's manual publish workflow at ubuntu24-dotnet10-opencv5.0.0 instead of the retired 4.13.0 image.
  • Fix docker-test-ubuntu.yml: the Dockerfile's test-native/test-dotnet stages were unreachable from the default build target, so BuildKit silently skipped them — the "Docker Test" CI never actually verified the native .so or ran dotnet test inside the image. Added explicit --target build steps for both stages so they run and can fail the job.
  • Fixed test-dotnet itself, which referenced the renamed OpenCvSharp.Extensions project (now OpenCvSharp.GdipExtensions) and built against the wrong TargetFramework; now matches the projects' actual net8.0/net10.0 targets.

Test plan

  • Confirm the Docker Test workflow passes on this PR (both full and slim jobs), including the new test-native/test-dotnet target steps
  • Confirm docker-deploy.yml still validates (workflow_dispatch input check) — not runnable from a PR, but review the diff for correctness

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Updated the Docker deployment image to the newer Ubuntu 24 / OpenCV 5.0.0 tag.
  • Bug Fixes
    • Improved the Docker test workflow to run validation earlier using cached test builds.
    • Updated the Docker test build to target .NET 8.0 for relevant OpenCvSharp extension projects.
  • Chores
    • Removed several obsolete Docker build definitions for older platform/OpenCV combinations.

…st stages

Remove unused Dockerfiles targeting EOL runtimes (.NET 5/6, .NET Core 3.1,
Amazon Linux Lambda, App Engine aspnetcore 3.1) that are not referenced by
any CI workflow and were only generating Renovate noise. Also drop the
superseded ubuntu24-dotnet10-opencv4.13.0 (+slim) images now that main
targets OpenCV 5.

Point docker-deploy.yml's manual publish workflow at the current
ubuntu24-dotnet10-opencv5.0.0 image instead of the retired 4.13.0 one.

Fix docker-test-ubuntu.yml so the Dockerfile's test-native/test-dotnet
stages actually run: they were unreachable from the default build target,
so BuildKit silently skipped them and the "Docker Test" CI never verified
anything beyond the final image assembling correctly. Add explicit
--target builds for both stages. This also surfaced that test-dotnet
referenced the renamed OpenCvSharp.Extensions -> OpenCvSharp.GdipExtensions
project and built it against the wrong TargetFramework; fixed to match the
projects' actual net8.0/net10.0 targets.
@coderabbitai

coderabbitai Bot commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7c0cf7ea-65ad-48af-b99a-6e6fbbda0048

📥 Commits

Reviewing files that changed from the base of the PR and between 4f6d5cc and 7ec4ed4.

📒 Files selected for processing (1)
  • packaging/docker/ubuntu24-dotnet10-opencv5.0.0/Dockerfile

📝 Walkthrough

Walkthrough

The deploy workflow now points to the ubuntu24-dotnet10-opencv5.0.0 image. The OpenCV 5.0.0 Dockerfile updates its CMake flags and test-dotnet builds. The docker-test workflow adds cache-only native and .NET test build steps.

Changes

Docker image target and CI updates

Layer / File(s) Summary
Deploy image tag update
.github/workflows/docker-deploy.yml
DOCKER_IMAGE_NAME1 changes from the OpenCV 4.13.0 image variant to the OpenCV 5.0.0 variant.
OpenCV 5 build and test-dotnet update
packaging/docker/ubuntu24-dotnet10-opencv5.0.0/Dockerfile
The Dockerfile adds an ASM compiler comment, updates the CMake configure arguments to disable ASM, and switches the test-dotnet build chain to net8.0 with OpenCvSharp.GdipExtensions.
Docker test cache-only build steps
.github/workflows/docker-test-ubuntu.yml
New cache-only test-native and test-dotnet build steps are added to build_full, and a cache-only test-native step is added to build_slim with ref/main-scoped cache settings.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant build_full
  participant build_slim
  participant DockerBuildxCache

  GitHubActions->>build_full: run test-native cache-only build
  build_full->>DockerBuildxCache: cache-to scoped full image layers
  GitHubActions->>build_full: run test-dotnet cache-only build
  build_full->>DockerBuildxCache: cache-to scoped full image layers
  GitHubActions->>build_slim: run test-native cache-only build
  build_slim->>DockerBuildxCache: cache-to scoped slim image layers
Loading

Possibly related PRs

  • shimat/opencvsharp#1834: Also changes GitHub Actions Docker build caching in .github/workflows/docker-test-ubuntu.yml using docker/build-push-action cache scopes and cache settings.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main changes: removing stale Docker images and fixing CI test stages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/modernize-docker-images

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/docker-test-ubuntu.yml (1)

27-66: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Cache-to scope reused across steps overwrites earlier caches.

The new test-native and test-dotnet steps and the existing final build step all write cache-to with the identical scope full-${{ github.ref_name }}. Per Docker's own docs, writing to the same gha cache scope more than once in a run means only the last write's cache survives, so the earlier cache-to writes here are effectively discarded — reducing the caching benefit these new steps were meant to provide for subsequent runs.

Consider giving each step its own scope suffix (e.g., full-test-native-${{ github.ref_name }}, full-test-dotnet-${{ github.ref_name }}) and listing all relevant scopes in each step's cache-from.

♻️ Example scope differentiation
       - name: Test native .so (full)
         uses: docker/build-push-action@v7
         with:
           context: .
           file: ${{ env.DOCKER_BUILD_CONTEXT_FULL }}/Dockerfile
           target: test-native
           build-args: |
             OPENCV_VERSION=${{ env.OPENCV_VERSION }}
           outputs: type=cacheonly
           cache-from: |
             type=gha,scope=full-${{ github.ref_name }}
             type=gha,scope=full-main
-          cache-to: type=gha,mode=min,scope=full-${{ github.ref_name }}
+          cache-to: type=gha,mode=min,scope=full-test-native-${{ github.ref_name }}

       - name: Test .NET class libraries (full)
         uses: docker/build-push-action@v7
         with:
           context: .
           file: ${{ env.DOCKER_BUILD_CONTEXT_FULL }}/Dockerfile
           target: test-dotnet
           build-args: |
             OPENCV_VERSION=${{ env.OPENCV_VERSION }}
           outputs: type=cacheonly
-          cache-from: |
-            type=gha,scope=full-${{ github.ref_name }}
-            type=gha,scope=full-main
-          cache-to: type=gha,mode=min,scope=full-${{ github.ref_name }}
+          cache-from: |
+            type=gha,scope=full-test-native-${{ github.ref_name }}
+            type=gha,scope=full-main
+          cache-to: type=gha,mode=min,scope=full-test-dotnet-${{ github.ref_name }}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/docker-test-ubuntu.yml around lines 27 - 66, The Docker
cache writes in the workflow are using the same gha scope across multiple steps,
so later `cache-to` writes overwrite earlier ones. Update the
`docker/build-push-action@v7` steps for `test-native`, `test-dotnet`, and the
final build to use unique cache scope suffixes, and adjust their `cache-from`
entries to include the relevant scopes so each step can reuse the others’
caches.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/docker-test-ubuntu.yml:
- Around line 78-91: The slim test step is sharing the same GitHub Actions cache
scope as the other slim build step, so its cache gets overwritten instead of
being stored independently. Update the cache settings in the test-native
build-push-action block to use a distinct scope for the slim test job, and keep
the existing slim build scope separate so each step writes and restores its own
cache cleanly.

---

Nitpick comments:
In @.github/workflows/docker-test-ubuntu.yml:
- Around line 27-66: The Docker cache writes in the workflow are using the same
gha scope across multiple steps, so later `cache-to` writes overwrite earlier
ones. Update the `docker/build-push-action@v7` steps for `test-native`,
`test-dotnet`, and the final build to use unique cache scope suffixes, and
adjust their `cache-from` entries to include the relevant scopes so each step
can reuse the others’ caches.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a46384d8-1131-44fa-95b7-74fd831a669f

📥 Commits

Reviewing files that changed from the base of the PR and between 4733587 and f6ffc66.

📒 Files selected for processing (11)
  • .github/workflows/docker-deploy.yml
  • .github/workflows/docker-test-ubuntu.yml
  • packaging/docker/al2-dotnet5-opencv4.6.0/Dockerfile
  • packaging/docker/al2-opencv4.5.1/Dockerfile
  • packaging/docker/appengine-aspnetcore3.1-opencv4.5.1/Dockerfile
  • packaging/docker/ubuntu22-dotnet6-opencv4.8.0/Dockerfile
  • packaging/docker/ubuntu22-dotnet6sdk-opencv4.7.0/Dockerfile
  • packaging/docker/ubuntu24-dotnet10-opencv4.13.0-slim/Dockerfile
  • packaging/docker/ubuntu24-dotnet10-opencv4.13.0/Dockerfile
  • packaging/docker/ubuntu24-dotnet10-opencv5.0.0/Dockerfile
  • packaging/docker/ubuntu24-dotnet8-opencv4.12.0/Dockerfile
💤 Files with no reviewable changes (8)
  • packaging/docker/ubuntu22-dotnet6sdk-opencv4.7.0/Dockerfile
  • packaging/docker/ubuntu24-dotnet8-opencv4.12.0/Dockerfile
  • packaging/docker/al2-dotnet5-opencv4.6.0/Dockerfile
  • packaging/docker/appengine-aspnetcore3.1-opencv4.5.1/Dockerfile
  • packaging/docker/ubuntu24-dotnet10-opencv4.13.0-slim/Dockerfile
  • packaging/docker/ubuntu22-dotnet6-opencv4.8.0/Dockerfile
  • packaging/docker/ubuntu24-dotnet10-opencv4.13.0/Dockerfile
  • packaging/docker/al2-opencv4.5.1/Dockerfile

Comment thread .github/workflows/docker-test-ubuntu.yml
shimat added 2 commits July 3, 2026 15:54
…d cache

test-native/test-dotnet steps shared the same GHA cache scope as the
subsequent final image build, so their cache-to write got clobbered by
the later build's cache-to save, evicting the test-only layers on every
run. Give each test step its own scope while still reading from the
shared scope for common base layers.
… the extern link

The now-actually-running test-native stage caught a pre-existing bug:
OpenCV 5.0.0's vendored MLAS declares and calls MlasHGemmSupported() on
its FP16/GQA path but never defines it, leaving libOpenCvSharpExtern.so
with an undefined reference. windows.yml/linux-arm64.yml/macos.yml already
work around this by dropping CMAKE_ASM_COMPILER so MLAS reports itself
unavailable and DNN falls back to its built-in SGEMM; apply the same fix
here.
@shimat
shimat merged commit c4b0f29 into main Jul 3, 2026
14 checks passed
@shimat
shimat deleted the chore/modernize-docker-images branch July 3, 2026 07:28
@shimat shimat added the enhancement New feature or improvement to OpenCvSharp label Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or improvement to OpenCvSharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant