Repository navigation
Fix media folder ownership in production Dockerfile - #7003
Merged
browniebroke merged 1 commit intoNov 3, 2026
Merged
Conversation
When cloud_provider is None the media folder is created with RUN mkdir, which runs as root. The non-recursive chown of APP_HOME below does not touch it, so django cannot write uploads. Chown the new directory only and keep the non-recursive chown of the WORKDIR. Fix cookiecutter#6999 Signed-off-by: Charan Rathore <[email protected]>
browniebroke
approved these changes
Nov 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.
Description
When
cloud_providerisNone, the production django Dockerfile creates the media folder withRUN mkdir -p, which runs as root. Thechown django:django ${APP_HOME}below it is not recursive (on purpose, to keep the build fast), so it never reaches the new directory and uploads fail withPermission denied.This chowns only the newly created media directory and leaves the non-recursive chown of the WORKDIR as it is.
Checklist:
Rationale
Fix #6999
The new test bakes the project with
use_docker=yand checks the generated Dockerfile: withcloud_provider=Nonethe media dir must be created and chowned to django, with AWS it must not appear. It fails on current master and passes with this change. I did not build the image or run the container; the check is on the rendered Dockerfile.