fix: Create media directory in Dockerfile.

If the media directory does not exist at the time that
uwsgi is launched, the mapping to /media to serve
media files will not be created.
This commit is contained in:
Andrés González 2024-04-12 14:24:12 -03:00 committed by Muhammad Faraz Maqsood
parent 4b1ccd4ea5
commit ecff88eb40
2 changed files with 4 additions and 0 deletions

View File

@ -0,0 +1 @@
- [Bugfix] Fix the docker image to allow media files to be served by uwsgi. (by @angonz)

View File

@ -73,6 +73,9 @@ RUN python manage.py compilemessages
COPY --chown=app:app assets.py ./course_discovery/settings/assets.py COPY --chown=app:app assets.py ./course_discovery/settings/assets.py
RUN DJANGO_SETTINGS_MODULE=course_discovery.settings.assets make static RUN DJANGO_SETTINGS_MODULE=course_discovery.settings.assets make static
# Create media directory to serve media files
RUN mkdir course_discovery/media
# Run production server # Run production server
ENV DJANGO_SETTINGS_MODULE course_discovery.settings.tutor.production ENV DJANGO_SETTINGS_MODULE course_discovery.settings.tutor.production
EXPOSE 8000 EXPOSE 8000