Skip to content

RE1-T119 Migrating to Docker Hardened Images#380

Open
ucswift wants to merge 1 commit into
masterfrom
develop
Open

RE1-T119 Migrating to Docker Hardened Images#380
ucswift wants to merge 1 commit into
masterfrom
develop

Conversation

@ucswift
Copy link
Copy Markdown
Member

@ucswift ucswift commented May 13, 2026

Summary by CodeRabbit

  • Chores
    • Updated Docker base images from Microsoft registry (mcr.microsoft.com/dotnet) to dhi.io/dotnet across six services
    • Refactored container startup sequences to use explicit ENTRYPOINT and CMD instructions for improved initialization flow

Review Change Stack

@request-info
Copy link
Copy Markdown

request-info Bot commented May 13, 2026

Thanks for opening this, but we'd appreciate a little more information. Could you update it with more details?

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

📝 Walkthrough

Walkthrough

All six containerized services update their Docker build and runtime infrastructure: base images migrate from mcr.microsoft.com/dotnet to dhi.io/dotnet registries, and container startup is refactored from shell-chained wait-script execution to explicit ENTRYPOINT and CMD patterns.

Changes

Docker image and startup pattern migration

Layer / File(s) Summary
Base and build image migration to dhi.io
Web/Resgrid.Web.Eventing/Dockerfile, Web/Resgrid.Web.Mcp/Dockerfile, Web/Resgrid.Web.Services/Dockerfile, Web/Resgrid.Web.Tts/Dockerfile, Web/Resgrid.Web/Dockerfile, Workers/Resgrid.Workers.Console/Dockerfile
Six Dockerfiles replace mcr.microsoft.com/dotnet runtime and SDK images with dhi.io/dotnet equivalents, updating image tags (e.g., 9.0.3-noble-amd64 → 9.0.16-debian13, 9.0.202-noble-amd64 → 9.0.314-sdk-debian13) across base and build stages.
Wait script refactoring to separate ENTRYPOINT/CMD
Web/Resgrid.Web.Eventing/Dockerfile, Web/Resgrid.Web.Mcp/Dockerfile, Web/Resgrid.Web.Services/Dockerfile, Web/Resgrid.Web.Tts/Dockerfile, Web/Resgrid.Web/Dockerfile, Workers/Resgrid.Workers.Console/Dockerfile
All services move the docker-compose-wait binary into the publish stage output directory (/app/publish/wait with executable permissions), then refactor container startup from shell-based ENTRYPOINT chains (sh -c "./wait && dotnet ...") to separate ENTRYPOINT ["./wait"] and CMD ["dotnet", "App.dll"] patterns.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • Resgrid/Core#340: Both PRs modify Web/Resgrid.Web.Tts/Dockerfile to change the Docker build/runtime setup (base/build stage images and related .NET container wiring), so the changes overlap at the same file and stage configuration level.
🚥 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 'RE1-T119 Migrating to Docker Hardened Images' accurately describes the main change: switching Docker base images from mcr.microsoft.com/dotnet to dhi.io/dotnet across multiple Dockerfiles.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 `@Web/Resgrid.Web.Eventing/Dockerfile`:
- Around line 5-11: Replace all dhi.io image tags used in FROM statements with
immutable digest pins (use the `@sha256`:<digest> form) so builds are
reproducible; specifically update each occurrence of images like
dhi.io/dotnet:9.0.16-debian13 and dhi.io/dotnet:9.0.314-sdk-debian13 (and any
other dhi.io/* references) to their corresponding sha256 digests in the
Dockerfile FROM lines, ensuring both the runtime and sdk images are pinned
across all six migrated Dockerfiles.

In `@Workers/Resgrid.Workers.Console/Dockerfile`:
- Around line 5-10: The Dockerfile uses Debian 13 base images (e.g., FROM
dhi.io/dotnet:9.0.314-sdk-debian13 AS build) but still installs an Ubuntu
Jammy-specific package (wkhtmltox_0.12.6.1-3.jammy_amd64.deb); replace that
Jammy .deb with a Debian 13-compatible wkhtmltopdf package or installation
method: either download the appropriate Debian 13/trixie .deb from wkhtmltopdf
releases, install wkhtmltopdf from Debian repositories via apt, or build/install
from source/official static binary, and update the Dockerfile to reference the
correct package filename and installation commands so dependencies match the
Debian 13 base image.
🪄 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: a9637143-e160-4c58-8daf-c2954cbe6fea

📥 Commits

Reviewing files that changed from the base of the PR and between aff8f96 and cfe98de.

📒 Files selected for processing (6)
  • Web/Resgrid.Web.Eventing/Dockerfile
  • Web/Resgrid.Web.Mcp/Dockerfile
  • Web/Resgrid.Web.Services/Dockerfile
  • Web/Resgrid.Web.Tts/Dockerfile
  • Web/Resgrid.Web/Dockerfile
  • Workers/Resgrid.Workers.Console/Dockerfile

Comment on lines +5 to +11
FROM dhi.io/dotnet:9.0.16-debian13 AS base
ARG BUILD_VERSION
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:9.0.202-noble-amd64 AS build
#FROM mcr.microsoft.com/dotnet/sdk:9.0.202-noble-amd64 AS build
FROM dhi.io/dotnet:9.0.314-sdk-debian13 AS build
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.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify all migrated Dockerfiles still use tag-only FROM references.
rg -n '^\s*FROM\s+dhi\.io\/[^\s]+' \
  Web/Resgrid.Web.Eventing/Dockerfile \
  Web/Resgrid.Web.Mcp/Dockerfile \
  Web/Resgrid.Web.Services/Dockerfile \
  Web/Resgrid.Web.Tts/Dockerfile \
  Web/Resgrid.Web/Dockerfile \
  Workers/Resgrid.Workers.Console/Dockerfile

# Expected follow-up: replace each with FROM ...@sha256:<digest>

Repository: Resgrid/Core

Length of output: 167


🏁 Script executed:

#!/bin/bash
# Fixed: use proper rg syntax to find all dhi.io FROM references
echo "=== Scanning for dhi.io references in Dockerfiles ==="
rg 'FROM\s+dhi\.io' -g 'Dockerfile*' -n

echo ""
echo "=== Checking each mentioned Dockerfile ==="
for dockerfile in \
  Web/Resgrid.Web.Eventing/Dockerfile \
  Web/Resgrid.Web.Mcp/Dockerfile \
  Web/Resgrid.Web.Services/Dockerfile \
  Web/Resgrid.Web.Tts/Dockerfile \
  Web/Resgrid.Web/Dockerfile \
  Workers/Resgrid.Workers.Console/Dockerfile; do
  if [ -f "$dockerfile" ]; then
    echo "--- $dockerfile ---"
    grep -n 'FROM.*dhi\.io' "$dockerfile" || echo "No dhi.io FROM found"
  else
    echo "$dockerfile: NOT FOUND"
  fi
done

Repository: Resgrid/Core

Length of output: 1986


Pin all dhi.io images by digest across the 6 migrated Dockerfiles.

All dhi.io FROM statements currently use tags only, leaving builds mutable. A retag can silently change runtime bits. Pin each reference with @sha256:<digest> to ensure deterministic, reproducible builds:

  • Web/Resgrid.Web.Eventing/Dockerfile (lines 5, 11)
  • Web/Resgrid.Web.Mcp/Dockerfile (lines 6, 12)
  • Web/Resgrid.Web.Services/Dockerfile (lines 6, 12)
  • Web/Resgrid.Web.Tts/Dockerfile (lines 4, 10)
  • Web/Resgrid.Web/Dockerfile (lines 5, 12)
  • Workers/Resgrid.Workers.Console/Dockerfile (lines 5, 10)
Suggested pattern
-FROM dhi.io/dotnet:9.0.16-debian13 AS base
+FROM dhi.io/dotnet:9.0.16-debian13@sha256:<runtime_digest> AS base
...
-FROM dhi.io/dotnet:9.0.314-sdk-debian13 AS build
+FROM dhi.io/dotnet:9.0.314-sdk-debian13@sha256:<sdk_digest> AS build
🤖 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 `@Web/Resgrid.Web.Eventing/Dockerfile` around lines 5 - 11, Replace all dhi.io
image tags used in FROM statements with immutable digest pins (use the
`@sha256`:<digest> form) so builds are reproducible; specifically update each
occurrence of images like dhi.io/dotnet:9.0.16-debian13 and
dhi.io/dotnet:9.0.314-sdk-debian13 (and any other dhi.io/* references) to their
corresponding sha256 digests in the Dockerfile FROM lines, ensuring both the
runtime and sdk images are pinned across all six migrated Dockerfiles.

Comment on lines +5 to +10
FROM dhi.io/dotnet:9.0.16-debian13 AS base
ARG BUILD_VERSION
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:9.0.202-noble-amd64 AS build
#FROM mcr.microsoft.com/dotnet/sdk:9.0.202-noble-amd64 AS build
FROM dhi.io/dotnet:9.0.314-sdk-debian13 AS build
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.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the distro/package mismatch in this Dockerfile.
rg -n '^\s*FROM\s+dhi\.io/dotnet:.*debian13' Workers/Resgrid.Workers.Console/Dockerfile
rg -n 'wkhtmltox_.*jammy_amd64\.deb' Workers/Resgrid.Workers.Console/Dockerfile

# Expected: both patterns match -> mismatch confirmed.
# Follow-up: use a Debian-compatible wkhtmltopdf package/build path.

Repository: Resgrid/Core

Length of output: 331


Replace the Ubuntu Jammy-specific wkhtmltopdf package with a Debian 13-compatible version.

The migration to Debian 13 base images (lines 5, 10) is incompatible with the Ubuntu Jammy-specific wkhtmltopdf package (lines 48, 57: wkhtmltox_0.12.6.1-3.jammy_amd64.deb). This distro mismatch can cause dependency resolution failures or runtime breakage due to libc and library incompatibilities between Debian 13 and Ubuntu Jammy.

🤖 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 `@Workers/Resgrid.Workers.Console/Dockerfile` around lines 5 - 10, The
Dockerfile uses Debian 13 base images (e.g., FROM
dhi.io/dotnet:9.0.314-sdk-debian13 AS build) but still installs an Ubuntu
Jammy-specific package (wkhtmltox_0.12.6.1-3.jammy_amd64.deb); replace that
Jammy .deb with a Debian 13-compatible wkhtmltopdf package or installation
method: either download the appropriate Debian 13/trixie .deb from wkhtmltopdf
releases, install wkhtmltopdf from Debian repositories via apt, or build/install
from source/official static binary, and update the Dockerfile to reference the
correct package filename and installation commands so dependencies match the
Debian 13 base image.

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