fix(docker): let non-root backend create its uploads dir (multer 2 eager mkdir) - #114
Merged
Merged
Conversation
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.
Problem
Staging
sync-servercrash-looped (16× restarts) after the volume/init-script fix (#113) cleared the postgres issue. Real cause, from the container log:Two recent changes collide:
mkdirSyncs adiskStoragedestination at route-construction (startup), where multer 1.x did not.nodeuser.WORKDIR /appis created root-owned, andCOPY --chown=node:nodeonly chowns the copied contents — not the/appdirectory itself. Sonodecan't create/app/uploads(the OpenSPP-field route's upload dir,path.resolve(process.cwd(), "uploads")) → uncaught exception → crash loop. DB init succeeds first, which is why it looked DB-related.Fix
In the
backendstage ofdocker/Dockerfile, beforeUSER node:RUN mkdir -p /app/uploads && chown node:node /app /app/uploadsGives
nodeownership of the workdir and pre-creates the uploads dir (multer's recursive mkdir then no-ops).Scope / impact
Affects any fresh deploy of the backend image — including production / v2.1.0 (same Dockerfile + multer 2 + non-root). Recommend cherry-picking to
main(or a2.1.1) after this merges. Verified by redeploying staging.🤖 Generated with Claude Code