Skip to content

RE1-T117 Fixing timezone issue in docker#406

Merged
ucswift merged 1 commit into
masterfrom
develop
Jun 10, 2026
Merged

RE1-T117 Fixing timezone issue in docker#406
ucswift merged 1 commit into
masterfrom
develop

Conversation

@ucswift

@ucswift ucswift commented Jun 10, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

Release Notes

  • Chores
    • Enhanced Docker build reliability across multiple services by implementing hardened timezone data validation. Timezone database is now explicitly verified during image builds, ensuring proper timezone support and preventing silent failures with missing zone files.

@request-info

request-info Bot commented Jun 10, 2026

Copy link
Copy Markdown

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

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR hardens Docker build robustness across six Dockerfiles by enforcing timezone database (tzdata) presence and completing a wkhtmltopdf dependency installation. The main pattern replaces plain package installation with --reinstall and explicit zoneinfo file validation to fail builds early if critical timezone data is missing.

Changes

Docker Build Hardening: Timezone and Dependency Installation

Layer / File(s) Summary
Harden tzdata installation across Web services
Web/Resgrid.Web.Eventing/Dockerfile, Web/Resgrid.Web.Mcp/Dockerfile, Web/Resgrid.Web.Services/Dockerfile, Web/Resgrid.Web.Tts/Dockerfile, Web/Resgrid.Web/Dockerfile
Replace simple apt-get install tzdata with --reinstall and explicit tests for /usr/share/zoneinfo/America/New_York and /usr/share/zoneinfo/Asia/Kolkata, causing image builds to fail if zone data is missing. Web.Tts additionally removes tzdata from an earlier batch install and adds it as a dedicated hardened step.
Complete wkhtmltopdf dependency and harden tzdata in Workers.Console
Workers/Resgrid.Workers.Console/Dockerfile
Download and install the wkhtmltopdf .deb package, extract its runtime libraries into /tmp/wkdeps, and apply the same tzdata hardening pattern (reinstall with zoneinfo file existence checks) as the Web services.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Resgrid/Core#405: Sets timezone behavior and ensures tzdata//usr/share/zoneinfo is present in final images; this PR further hardens installation via --reinstall and explicit zoneinfo file existence checks.
🚥 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 accurately describes the main change across all modified Dockerfiles: implementing hardened timezone (tzdata) installation with validation checks to ensure zoneinfo files exist.
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.

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Workers/Resgrid.Workers.Console/Dockerfile (1)

44-65: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Add file existence check in library extraction loop.

The ldd output parsing at line 64 doesn't verify that extracted paths are valid files before copying. If ldd outputs virtual DSOs or the parsing yields invalid paths, cp will fail with unclear errors. Other Dockerfiles in this codebase (e.g., Web.Tts line 85) use [ -f "$lib" ] && cp to filter out non-file entries.

🛡️ Proposed defensive fix
     && wget -q https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb \
     && dpkg -i wkhtmltox_0.12.6.1-3.bookworm_amd64.deb || apt-get install -fy \
     && rm -f wkhtmltox_0.12.6.1-3.bookworm_amd64.deb \
     && mkdir -p /tmp/wkdeps \
-    && ldd /usr/local/bin/wkhtmltopdf | awk '/=>/ {print $3}' | while read lib; do cp "$lib" /tmp/wkdeps/; done \
+    && ldd /usr/local/bin/wkhtmltopdf | awk '/=>/ {print $3}' | while read lib; do [ -f "$lib" ] && cp "$lib" /tmp/wkdeps/; done \
     && apt-get clean && rm -rf /var/lib/apt/lists/*
🤖 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 44 - 65, The ldd
parsing loop that copies runtime libraries for /usr/local/bin/wkhtmltopdf can
attempt to cp non-file entries (virtual DSOs) and fail; update the loop that
reads libs from ldd /usr/local/bin/wkhtmltopdf so it checks file existence
before copying (e.g., test [ -f "$lib" ] && cp "$lib" /tmp/wkdeps/), ensuring
only real files are copied into /tmp/wkdeps and avoiding cp errors during the
Docker build.
🤖 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/Dockerfile`:
- Around line 27-29: The RUN instruction installing tzdata in the Dockerfile
(the line invoking DEBIAN_FRONTEND=noninteractive apt-get install -y --reinstall
--no-install-recommends tzdata and the subsequent test -f checks for zoneinfo
files) is missing the apt cache cleanup used in other Dockerfiles; update that
RUN chain to append && rm -rf /var/lib/apt/lists/* after the zoneinfo tests so
temporary apt lists are removed and the image layer size is minimized.

---

Outside diff comments:
In `@Workers/Resgrid.Workers.Console/Dockerfile`:
- Around line 44-65: The ldd parsing loop that copies runtime libraries for
/usr/local/bin/wkhtmltopdf can attempt to cp non-file entries (virtual DSOs) and
fail; update the loop that reads libs from ldd /usr/local/bin/wkhtmltopdf so it
checks file existence before copying (e.g., test [ -f "$lib" ] && cp "$lib"
/tmp/wkdeps/), ensuring only real files are copied into /tmp/wkdeps and avoiding
cp errors during the Docker build.
🪄 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: 1eb9bc0c-b235-4dd4-94d7-f0ab38504243

📥 Commits

Reviewing files that changed from the base of the PR and between 0089d6a and 50e053f.

📒 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 +27 to +29
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --reinstall --no-install-recommends tzdata \
&& test -f /usr/share/zoneinfo/America/New_York \
&& test -f /usr/share/zoneinfo/Asia/Kolkata

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 | 🟡 Minor | ⚡ Quick win

Add apt lists cleanup to match other Dockerfiles.

All other Dockerfiles in this PR append && rm -rf /var/lib/apt/lists/* after the zoneinfo file checks to minimize layer size. This one is missing that cleanup step.

🧹 Proposed fix
 RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --reinstall --no-install-recommends tzdata \
     && test -f /usr/share/zoneinfo/America/New_York \
-    && test -f /usr/share/zoneinfo/Asia/Kolkata
+    && test -f /usr/share/zoneinfo/Asia/Kolkata \
+    && rm -rf /var/lib/apt/lists/*
🤖 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/Dockerfile` around lines 27 - 29, The RUN instruction
installing tzdata in the Dockerfile (the line invoking
DEBIAN_FRONTEND=noninteractive apt-get install -y --reinstall
--no-install-recommends tzdata and the subsequent test -f checks for zoneinfo
files) is missing the apt cache cleanup used in other Dockerfiles; update that
RUN chain to append && rm -rf /var/lib/apt/lists/* after the zoneinfo tests so
temporary apt lists are removed and the image layer size is minimized.

@ucswift

ucswift commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

Approve

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR is approved.

@ucswift ucswift merged commit b94da09 into master Jun 10, 2026
19 checks passed
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