From d19bd53b2b4b0415d3f4870f3c20db7e6c4824a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Thu, 14 Nov 2019 11:29:25 +0100 Subject: [PATCH] Fix missing bundle static assets in dev mode The static assets need to be properly collected in the development image in order to have a working webpack-stats.json file. The /openedx/staticfiles folder is still bind-mounted in the docker image in order to have a working `watchthemes` command. This is for issue #235, again. --- tutor/templates/build/openedx-dev/Dockerfile | 9 +++++++-- tutor/templates/dev/docker-compose.yml | 3 +-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tutor/templates/build/openedx-dev/Dockerfile b/tutor/templates/build/openedx-dev/Dockerfile index 49ead48..57b6cbd 100644 --- a/tutor/templates/build/openedx-dev/Dockerfile +++ b/tutor/templates/build/openedx-dev/Dockerfile @@ -10,6 +10,13 @@ RUN apt update && \ RUN pip install -r requirements/edx/development.txt RUN pip install ipdb==0.12.2 ipython==5.8.0 +# Recompile static assets: in development mode all static assets are stored in edx-platform, +# and the location of these files is stored in webpack-stats.json. If we don't recompile +# static assets, then production assets will be served instead. +RUN rm -r /openedx/staticfiles && \ + mkdir /openedx/staticfiles && \ + openedx-assets webpack --env=dev + # Copy new entrypoint (to take care of permission issues at runtime) COPY ./bin /openedx/bin RUN chmod a+x /openedx/bin/* @@ -20,5 +27,3 @@ RUN create-user.sh $USERID # Default django settings ENV SETTINGS tutor.development - -# TODO recompile static assets and point to edx-platform \ No newline at end of file diff --git a/tutor/templates/dev/docker-compose.yml b/tutor/templates/dev/docker-compose.yml index f277b4f..1b3f92e 100644 --- a/tutor/templates/dev/docker-compose.yml +++ b/tutor/templates/dev/docker-compose.yml @@ -5,8 +5,6 @@ services: &openedx-service image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_OPENEDX_DEV }} volumes: - # static assets - - ../../data/openedx/staticfiles:/openedx/staticfiles # theme files - ../build/openedx/themes:/openedx/themes # editable requirements @@ -25,5 +23,6 @@ services: watchthemes: <<: *openedx-service command: openedx-assets watch-themes --env dev + restart: unless-stopped {{ patch("local-docker-compose-dev-services")|indent(2) }} \ No newline at end of file