diff --git a/README.rst b/README.rst index be3f9a2f..6e7a0aa3 100644 --- a/README.rst +++ b/README.rst @@ -258,6 +258,34 @@ In both cases above, the ``npm`` commands affect every MFE being built. If you ] ) +In case you need to run additional instructions just before the build step you can use the ``mfe-dockerfile-pre-npm-build`` or ``mfe-dockerfile-pre-npm-build-*`` patches. For example, you may want to override existing env variables or define new ones. +:: + + from tutor import hooks + + hooks.Filters.ENV_PATCHES.add_items( + [ + ( + "mfe-dockerfile-pre-npm-build", + """ + ENV ENABLE_NEW_RELIC=true + ENV NEW_RELIC_ACCOUNT_ID="111111" + ENV NEW_RELIC_AGENT_ID="2222222222" + ENV NEW_RELIC_TRUST_KEY="333333" + ENV NEW_RELIC_LICENSE_KEY="4444444444" + ENV NEW_RELIC_APP_ID="5555555555" + """ + ), + # Only for the learning MFE + ( + "mfe-dockerfile-pre-npm-build-learning", + """ENV CUSTOM_VAR="custom-value" + """ + ), + ] + ) + + Installing from a private npm registry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/changelog.d/20230828_101247_moises.gonzalez_pre_build_patch.md b/changelog.d/20230828_101247_moises.gonzalez_pre_build_patch.md new file mode 100644 index 00000000..5502ea5c --- /dev/null +++ b/changelog.d/20230828_101247_moises.gonzalez_pre_build_patch.md @@ -0,0 +1,14 @@ + + + + + + +- [Improvement] Include additional patches in the Dockerfile to add instructions just before the build step. (by @MoisesGSalas) diff --git a/tutormfe/templates/mfe/build/mfe/Dockerfile b/tutormfe/templates/mfe/build/mfe/Dockerfile index 5176c322..f0d74c26 100644 --- a/tutormfe/templates/mfe/build/mfe/Dockerfile +++ b/tutormfe/templates/mfe/build/mfe/Dockerfile @@ -78,6 +78,8 @@ ENV PUBLIC_PATH='/{{ app_name }}/' # So we point to a relative url that will be a proxy for the LMS. ENV MFE_CONFIG_API_URL=/api/mfe_config/v1 ARG ENABLE_NEW_RELIC=false +{{ patch("mfe-dockerfile-pre-npm-build") }} +{{ patch("mfe-dockerfile-pre-npm-build-{}".format(app_name)) }} ######## {{ app_name }} (dev) FROM {{ app_name }}-common AS {{ app_name }}-dev