From 34a26281527aac326783316378fb36e6316e65db Mon Sep 17 00:00:00 2001 From: "Kyle D. McCormick" Date: Thu, 5 Sep 2024 14:40:53 -0400 Subject: [PATCH] feat: move translations and collectstatic out of dev image --- tutor/templates/build/openedx/Dockerfile | 46 ++++++++++++------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/tutor/templates/build/openedx/Dockerfile b/tutor/templates/build/openedx/Dockerfile index 5be0c29c71..c20d1e04f5 100644 --- a/tutor/templates/build/openedx/Dockerfile +++ b/tutor/templates/build/openedx/Dockerfile @@ -191,20 +191,6 @@ ENV REVISION_CFG=/openedx/config/revisions.yml COPY --chown=app:app settings/lms/*.py ./lms/envs/tutor/ COPY --chown=app:app settings/cms/*.py ./cms/envs/tutor/ -# Pull latest translations via atlas -RUN make clean_translations -RUN ./manage.py lms --settings=tutor.i18n pull_plugin_translations --verbose --repository='{{ ATLAS_REPOSITORY }}' --revision='{{ ATLAS_REVISION }}' {{ ATLAS_OPTIONS }} -RUN ./manage.py lms --settings=tutor.i18n pull_xblock_translations --repository='{{ ATLAS_REPOSITORY }}' --revision='{{ ATLAS_REVISION }}' {{ ATLAS_OPTIONS }} -RUN atlas pull --repository='{{ ATLAS_REPOSITORY }}' --revision='{{ ATLAS_REVISION }}' {{ ATLAS_OPTIONS }} \ - translations/edx-platform/conf/locale:conf/locale \ - translations/studio-frontend/src/i18n/messages:conf/plugins-locale/studio-frontend -RUN ./manage.py lms --settings=tutor.i18n compile_xblock_translations -RUN ./manage.py cms --settings=tutor.i18n compile_xblock_translations -RUN ./manage.py lms --settings=tutor.i18n compile_plugin_translations -RUN ./manage.py lms --settings=tutor.i18n compilemessages -v1 -RUN ./manage.py lms --settings=tutor.i18n compilejsi18n -RUN ./manage.py cms --settings=tutor.i18n compilejsi18n - # Copy scripts COPY --chown=app:app ./bin /openedx/bin RUN chmod a+x /openedx/bin/* @@ -212,15 +198,6 @@ ENV PATH=/openedx/bin:${PATH} {{ patch("openedx-dockerfile-pre-assets") }} -# Collect assets for the production image, de-duping assets with symlinks. -# This includes static assets from 3rd party packages, such as Django admin. -# If the tutor-legacyfrontends plugin is enabled, then this will also collect -# the CSS & JS bundles produced by the edx-platform frontend build. -RUN ./manage.py lms collectstatic --noinput --settings=tutor.assets && \ - ./manage.py cms collectstatic --noinput --settings=tutor.assets && \ - # De-duplicate static assets with symlinks \ - rdfind -makesymlinks true -followsymlinks true /openedx/staticfiles/ - # Create a data directory, which might be used (or not) RUN mkdir /openedx/data @@ -281,6 +258,29 @@ CMD ["./manage.py", "$SERVICE_VARIANT", "runserver", "0.0.0.0:8000"] ###### Final image with production cmd FROM production AS final +# Pull latest translations via atlas +RUN make clean_translations +RUN ./manage.py lms --settings=tutor.i18n pull_plugin_translations --verbose --repository='{{ ATLAS_REPOSITORY }}' --revision='{{ ATLAS_REVISION }}' {{ ATLAS_OPTIONS }} +RUN ./manage.py lms --settings=tutor.i18n pull_xblock_translations --repository='{{ ATLAS_REPOSITORY }}' --revision='{{ ATLAS_REVISION }}' {{ ATLAS_OPTIONS }} +RUN atlas pull --repository='{{ ATLAS_REPOSITORY }}' --revision='{{ ATLAS_REVISION }}' {{ ATLAS_OPTIONS }} \ + translations/edx-platform/conf/locale:conf/locale \ + translations/studio-frontend/src/i18n/messages:conf/plugins-locale/studio-frontend +RUN ./manage.py lms --settings=tutor.i18n compile_xblock_translations +RUN ./manage.py cms --settings=tutor.i18n compile_xblock_translations +RUN ./manage.py lms --settings=tutor.i18n compile_plugin_translations +RUN ./manage.py lms --settings=tutor.i18n compilemessages -v1 +RUN ./manage.py lms --settings=tutor.i18n compilejsi18n +RUN ./manage.py cms --settings=tutor.i18n compilejsi18n + +# Collect assets for the production image, de-duping assets with symlinks. +# This includes static assets from 3rd party packages, such as Django admin. +# If the tutor-legacyfrontends plugin is enabled, then this will also collect +# the CSS & JS bundles produced by the edx-platform frontend build. +RUN ./manage.py lms collectstatic --noinput --settings=tutor.assets && \ + ./manage.py cms collectstatic --noinput --settings=tutor.assets && \ + # De-duplicate static assets with symlinks \ + rdfind -makesymlinks true -followsymlinks true /openedx/staticfiles/ + # Default amount of uWSGI processes ENV UWSGI_WORKERS=2