fix: seed nonroot-owned data dir in release Docker image - #49
Merged
Conversation
📝 WalkthroughWalkthroughThe release Dockerfile adds an Alpine preparation stage that seeds ChangesRelease image filesystem setup
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
Anonymous/named Docker volumes inherited root ownership when /var/lib/mailtrap-local was missing from the image, so SQLite failed with unable to open database file (14). Match Dockerfile by seeding the path from an alpine stage as UID 65532. Co-authored-by: Cursor <cursoragent@cursor.com>
leonid-shevtsov
force-pushed
the
fix/docker-volume-nonroot-ownership
branch
from
July 30, 2026 08:24
0af80d8 to
c933c58
Compare
mklocek
approved these changes
Jul 31, 2026
piobeny
approved these changes
Aug 3, 2026
Rabsztok
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Release image (
Dockerfile.goreleaser) declaredVOLUME /var/lib/mailtrap-localbut never created that directory owned by distrolessnonroot(UID 65532). Empty anonymous/named volumes then mounted as root:root, so the process could not createdb.sqlite3(unable to open database file (14)).--tmpfsworked because it is world-writable.Fix: alpine stage seeds an empty dir;
COPY --chown=nonroot:nonrootinto the image (same pattern as the source-buildDockerfile). Ownership comes from--chownonly — no redundantRUN chown.CI: the
dockerjob now also buildsDockerfile.goreleaser(reuses the binary from the source image) and boots it on the default CMD, so this class of VOLUME/ownership regression cannot slip past again.Local smoke (linux/arm64 binary +
docker build -f Dockerfile.goreleaser):-v /var/lib/mailtrap-local→open store/unable to open database file (14)-v /var/lib/mailtrap-local→ SMTP + HTTP listening; wrotesecret.key+db.sqlite365532:65532How to test
docker run --rm -p 3535:3535 -p 3550:3550 -v /var/lib/mailtrap-local mailtrap/mailtrap-local:<this-build>starts without DB errors; UI at http://127.0.0.1:3550-v mailtrap-local:/var/lib/mailtrap-local(fresh named volume); no manual chowndockerjob green (source Dockerfile + goreleaser image boots)