Skip to content

Commit

Permalink
build: switch to new edx-platform asset build
Browse files Browse the repository at this point in the history
  • Loading branch information
kdmccormick committed Oct 5, 2023
1 parent 2ce2b74 commit c9e0684
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions tutor/templates/build/openedx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -200,25 +200,20 @@ ENV PATH /openedx/bin:${PATH}

{{ patch("openedx-dockerfile-pre-assets") }}

# Collect production assets. By default, only assets from the default theme
# Build & collect production assets. By default, only assets from the default theme
# will be processed. This makes the docker image lighter and faster to build.
# Only the custom themes added to /openedx/themes will be compiled.
# Here, we don't run "paver update_assets" which is slow, compiles all themes
# and requires a complex settings file. Instead, we decompose the commands
# and run each one individually to collect the production static assets to
# /openedx/staticfiles.
ENV NO_PYTHON_UNINSTALL 1
ENV NO_PREREQ_INSTALL 1
# We need to rely on a separate openedx-assets command to accelerate asset processing.
# For instance, we don't want to run all steps of asset collection every time the theme
# is modified.
RUN openedx-assets xmodule \
&& openedx-assets npm \
&& openedx-assets webpack --env=prod \
&& openedx-assets common

ENV EDX_PLATFORM_ASSET_OPTS "--theme-dirs /openedx/themes --static-root /openedx/staticfiles"
RUN scripts/build-assets.sh xmodule
RUN scripts/build-assets.sh npm
RUN scripts/build-assets.sh webpack
RUN scripts/build-assets.sh css

COPY --chown=app:app ./themes/ /openedx/themes/
RUN openedx-assets themes \
&& openedx-assets collect --settings=tutor.assets \
RUN scripts/build-assets.sh themes

RUN openedx-assets collect --settings=tutor.assets \
# De-duplicate static assets with symlinks
&& rdfind -makesymlinks true -followsymlinks true /openedx/staticfiles/

Expand Down Expand Up @@ -264,7 +259,7 @@ ENV PYTHONBREAKPOINT=ipdb.set_trace
# static assets, then production assets will be served instead.
RUN rm -r /openedx/staticfiles && \
mkdir /openedx/staticfiles && \
openedx-assets webpack --env=dev
scripts/build-assets.sh webpack --env dev

{{ patch("openedx-dev-dockerfile-post-python-requirements") }}

Expand Down

0 comments on commit c9e0684

Please sign in to comment.