From 2c54970f96f7977f5cc56a460a59cba6794ffe33 Mon Sep 17 00:00:00 2001 From: Shadi Naif Date: Wed, 15 Nov 2023 09:41:20 +0300 Subject: [PATCH] feat: Add atlas pull to Dockerfile Adding the pull behind a feature flag until it's fully implemented Refs: FC-0012 OEP-58 --- changelog.d/20231124_112904_shadinaif_atlas_pull.md | 1 + tutorecommerce/plugin.py | 1 + .../templates/ecommerce/build/ecommerce/Dockerfile | 11 +++++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 changelog.d/20231124_112904_shadinaif_atlas_pull.md diff --git a/changelog.d/20231124_112904_shadinaif_atlas_pull.md b/changelog.d/20231124_112904_shadinaif_atlas_pull.md new file mode 100644 index 00000000..9a038512 --- /dev/null +++ b/changelog.d/20231124_112904_shadinaif_atlas_pull.md @@ -0,0 +1 @@ +- [Feature] Pull translations via `atlas` during Docker build. (by @shadinaif) diff --git a/tutorecommerce/plugin.py b/tutorecommerce/plugin.py index a8d0cedf..0a23beed 100644 --- a/tutorecommerce/plugin.py +++ b/tutorecommerce/plugin.py @@ -54,6 +54,7 @@ }, }, }, + "ATLAS_PULL": False, }, "unique": { "MYSQL_PASSWORD": "{{ 8|random_string }}", diff --git a/tutorecommerce/templates/ecommerce/build/ecommerce/Dockerfile b/tutorecommerce/templates/ecommerce/build/ecommerce/Dockerfile index 4399be0e..70c75ca4 100644 --- a/tutorecommerce/templates/ecommerce/build/ecommerce/Dockerfile +++ b/tutorecommerce/templates/ecommerce/build/ecommerce/Dockerfile @@ -2,15 +2,16 @@ ###### Minimal image with base system requirements for most stages FROM docker.io/ubuntu:20.04 as minimal +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 + apt install -y curl gettext git-core language-pack-en ###### Checkout code FROM minimal as checkout -ARG ECOMMERCE_REPOSITORY=https://github.com/edx/ecommerce.git +ARG ECOMMERCE_REPOSITORY=https://github.com/openedx/ecommerce.git ARG ECOMMERCE_VERSION='{{ OPENEDX_COMMON_VERSION }}' RUN mkdir -p /openedx/ecommerce && \ git clone $ECOMMERCE_REPOSITORY --branch $ECOMMERCE_VERSION --depth 1 /openedx/ecommerce @@ -79,6 +80,12 @@ RUN cd /openedx/requirements/ \ {% for extra_requirement in ECOMMERCE_EXTRA_PIP_REQUIREMENTS %}RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared,uid=${APP_USER_ID} {% endif %}pip install '{{ extra_requirement }}' {% endfor %} +{% if ECOMMERCE_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/ecommerce/ecommerce/conf/locale:ecommerce/conf/locale +RUN python manage.py compilemessages +{% endif %} + {{ patch("ecommerce-dockerfile-pre-assets") }} # Collect static assets (aka: "make static")