From b9dd9409032fb9df370d509d5a44004817ca6397 Mon Sep 17 00:00:00 2001 From: Omar Al-Ithawi Date: Wed, 2 Aug 2023 09:07:00 +0300 Subject: [PATCH] feat: add minimal `atlas` step to the build This contribution is part of the [FC-0012 project](https://openedx.atlassian.net/l/cp/XGS0iCcQ) which is sparked by the [Translation Infrastructure update OEP-58](https://open-edx-proposals.readthedocs.io/en/latest/architectural-decisions/oep-0058-arch-translations-management.html#specification). --- changelog.d/20230909_160414_i_atlas.md | 1 + tutordiscovery/plugin.py | 1 + .../templates/discovery/build/discovery/Dockerfile | 12 ++++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 changelog.d/20230909_160414_i_atlas.md diff --git a/changelog.d/20230909_160414_i_atlas.md b/changelog.d/20230909_160414_i_atlas.md new file mode 100644 index 0000000..d0fa4a7 --- /dev/null +++ b/changelog.d/20230909_160414_i_atlas.md @@ -0,0 +1 @@ +- [Feature] Pull translations via `atlas` during Docker build. (by @OmarIthawi) diff --git a/tutordiscovery/plugin.py b/tutordiscovery/plugin.py index 3e36638..7e73ee8 100644 --- a/tutordiscovery/plugin.py +++ b/tutordiscovery/plugin.py @@ -31,6 +31,7 @@ "OAUTH2_KEY_SSO": "discovery-sso", "OAUTH2_KEY_SSO_DEV": "discovery-sso-dev", "CACHE_REDIS_DB": "{{ OPENEDX_CACHE_REDIS_DB }}", + "ATLAS_PULL": False, "EXTRA_PIP_REQUIREMENTS": [], }, } diff --git a/tutordiscovery/templates/discovery/build/discovery/Dockerfile b/tutordiscovery/templates/discovery/build/discovery/Dockerfile index 9c5b80a..c0499d9 100644 --- a/tutordiscovery/templates/discovery/build/discovery/Dockerfile +++ b/tutordiscovery/templates/discovery/build/discovery/Dockerfile @@ -6,7 +6,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked{% endif %} \ apt update && \ - apt install -y curl git-core language-pack-en python3 python3-dev python3-pip python3-venv \ + apt install -y curl git-core gettext language-pack-en python3 python3-dev python3-pip python3-venv \ build-essential libcairo2 libffi-dev libmysqlclient-dev libxml2-dev libxslt-dev libjpeg-dev libssl-dev \ pkg-config ENV LC_ALL en_US.UTF-8 @@ -61,7 +61,15 @@ RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip, # Use redis as a django cache https://pypi.org/project/django-redis/ django-redis==5.2.0 \ # uwsgi server https://pypi.org/project/uWSGI/ - uwsgi==2.0.21 + uwsgi==2.0.21 \ + # Open edX Atlas tranlsation management tool https://pypi.org/project/openedx-atlas/ + openedx-atlas==0.5.0 + +{% if DISCOVERY_ATLAS_PULL %} +# Pull translations. Support the OEP-58 proposal behind a feature flag until it's fully implemented. +RUN atlas pull {{ patch("atlas-extra-args") }} translations/course-discovery/course_discovery/conf/locale:course_discovery/conf/locale +RUN python manage.py compilemessages +{% endif %} # Collect static assets COPY --chown=app:app assets.py ./course_discovery/settings/assets.py