fix(docker): chown /app workdir so Chainlit can write .files#6
Merged
Conversation
WORKDIR /app creates the directory as root before COPY runs, and COPY --chown only sets ownership on the files it copies — not on the pre-existing parent. At startup Chainlit calls FILES_DIRECTORY.mkdir(exist_ok=True) which expands to /app/.files and fails with PermissionError because /app is still root-owned when we drop to the `app` user. Adds an explicit `chown app:app /app` after the COPY, before USER switches. Verified by reading the failing log on Fly: PermissionError: [Errno 13] Permission denied: '/app/.files'
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.
Summary
First Fly deploy crashed at startup with:
WORKDIR /appcreates the directory as root beforeCOPYruns;COPY --chown=app:apponly sets ownership on files it copies, not on the pre-existing parent dir. At startup Chainlit callsFILES_DIRECTORY.mkdir(exist_ok=True)(resolves to/app/.files) which fails because the workdir is still root-owned when we drop to theappuser.Fix: explicit
chown app:app /appafter the COPY, beforeUSERswitches.Test plan
uv run ruff check ./format --check— passes (Dockerfile only)