From f6cdea2f13196ee308dbc922de657f2506d5d432 Mon Sep 17 00:00:00 2001 From: Deborah Kaplan Date: Mon, 26 Jan 2026 20:05:45 +0000 Subject: [PATCH] feat: switching to local translations for IDAs - atlas using IDAs (credentials and discovery) switched to using local translations - fixes a mistaken removal of creds transltions from https://github.com/edx/public-dockerfiles/pull/153 - in credentials, switches a dedicated run of to a more complete translation-building tested the docker build locally FIXES: AU-2730 --- dockerfiles/course-discovery.Dockerfile | 10 ++++++++-- dockerfiles/credentials.Dockerfile | 12 ++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/dockerfiles/course-discovery.Dockerfile b/dockerfiles/course-discovery.Dockerfile index 4286cfd..b427be4 100644 --- a/dockerfiles/course-discovery.Dockerfile +++ b/dockerfiles/course-discovery.Dockerfile @@ -76,7 +76,10 @@ EXPOSE 8381 FROM app AS prod -ENV DJANGO_SETTINGS_MODULE "course_discovery.settings.production" +ARG OPENEDX_TRANSLATIONS_REPO + +ENV DJANGO_SETTINGS_MODULE="course_discovery.settings.production" +ENV ATLAS_OPTIONS="--repository=$OPENEDX_TRANSLATIONS_REPO" RUN pip install -r ${DISCOVERY_CODE_DIR}/requirements/production.txt @@ -86,9 +89,12 @@ CMD gunicorn --bind=0.0.0.0:8381 --workers 2 --max-requests=1000 -c course_disco FROM app AS dev +ARG OPENEDX_TRANSLATIONS_REPO + RUN curl -L -o ${DISCOVERY_CODE_DIR}/course_discovery/settings/devstack.py https://raw.githubusercontent.com/edx/devstack/master/py_configuration_files/course_discovery.py -ENV DJANGO_SETTINGS_MODULE "course_discovery.settings.devstack" +ENV DJANGO_SETTINGS_MODULE="course_discovery.settings.devstack" +ENV ATLAS_OPTIONS="--repository=$OPENEDX_TRANSLATIONS_REPO" RUN pip install -r ${DISCOVERY_CODE_DIR}/requirements/django.txt RUN pip install -r ${DISCOVERY_CODE_DIR}/requirements/local.txt diff --git a/dockerfiles/credentials.Dockerfile b/dockerfiles/credentials.Dockerfile index 1a0a48f..7e72e6d 100644 --- a/dockerfiles/credentials.Dockerfile +++ b/dockerfiles/credentials.Dockerfile @@ -3,12 +3,14 @@ # SecretsUsedInArgOrEnv check gets false positives on the name CREDENTIALS FROM ubuntu:jammy AS base +ARG OPENEDX_TRANSLATIONS_REPO ARG CREDENTIALS_SERVICE_REPO=openedx/credentials ARG CREDENTIALS_SERVICE_VERSION=master ARG PYTHON_VERSION=3.12 ENV TZ=UTC ENV TERM=xterm-256color ENV DEBIAN_FRONTEND=noninteractive +ENV ATLAS_OPTIONS="--repository=$OPENEDX_TRANSLATIONS_REPO" # software-properties-common is needed to setup our Python 3.12 env RUN apt-get update && \ @@ -108,12 +110,15 @@ RUN mkdir -p /edx/var/log # Cloning git repo. This line is after the python requirements so that changes to the code will not bust the image cache ADD https://github.com/${CREDENTIALS_SERVICE_REPO}.git#${CREDENTIALS_SERVICE_VERSION} /edx/app/credentials/credentials +# Fetch the translations into the image once the Makefile is in place +RUN make pull_translations + # Install frontend dependencies in node_modules directory RUN npm install --no-save ENV NODE_BIN=/edx/app/credentials/credentials/node_modules ENV PATH="$NODE_BIN/.bin:$PATH" -# Run webpack -RUN webpack --config webpack.config.js +# make static, which also runs webpack +RUN make static # Change static folder owner to application user. RUN chown -R app:app /edx/app/credentials/credentials/credentials/static @@ -128,9 +133,12 @@ CMD gunicorn --workers=2 --name credentials -c /edx/app/credentials/credentials/ FROM base AS dev USER root +ARG OPENEDX_TRANSLATIONS_REPO + RUN curl -L -o credentials/settings/devstack.py https://raw.githubusercontent.com/edx/devstack/${CREDENTIALS_SERVICE_VERSION}/py_configuration_files/credentials.py ENV DJANGO_SETTINGS_MODULE=credentials.settings.devstack +ENV ATLAS_OPTIONS="--repository=$OPENEDX_TRANSLATIONS_REPO" RUN pip install -r /edx/app/credentials/credentials/requirements/dev.txt RUN make pull_translations