Issue with Building MFE Docker Image After Forking edx/brand-edx.org

Hi Everyone,

I’ve encountered an issue while setting up Open edX on an AWS EC2 instance using Tutor (version 17.0.1). To customize the color scheme in MFE pages, I forked the edx/brand-edx.org repository. I created a plugin to incorporate my organization’s branding by following these steps:

Created mymfe_plugin.py at /home/ubuntu/.local/share/tutor-plugins/ with the following content:

from tutor import hooks

hooks.Filters.ENV_PATCHES.add_items(
    [
        (
            "mfe-dockerfile-post-npm-install",
            """
RUN npm install '@edx/brand@git+https://github.com/<MyOrg>/<MyOrg>-Brand.git'
            """
        )
    ]
)

Enabled the plugin and saved the configuration:

tutor plugins enable mymfe_plugin
tutor config save

Attempted to build the MFE image without cache:

tutor images build mfe --no-cache

However, the build failed, and I am unsure why, as there have been no changes to the forked repository yet. Here is error logs:

 => CANCELED [profile-prod 1/1] RUN npm run build                                                                                                                 78.8s
------
 > [communications-common 3/7] RUN --mount=type=cache,target=/root/.npm,sharing=shared npm clean-install --no-audit --no-fund --registry=https://registry.npmjs.org/:
443.1 npm notice 
443.1 npm notice New minor version of npm available! 10.2.3 -> 10.7.0
443.1 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.7.0>
443.1 npm notice Run `npm install -g npm@10.7.0` to update!
443.1 npm notice 
443.1 npm ERR! code ECONNRESET
443.1 npm ERR! errno ECONNRESET
443.1 npm ERR! network request to https://registry.npmjs.org/bytes failed, reason: socket hang up
443.1 npm ERR! network This is a problem related to network connectivity.
443.1 npm ERR! network In most cases you are behind a proxy or have bad network settings.
443.1 npm ERR! network 
443.1 npm ERR! network If you are behind a proxy, please make sure that the
443.1 npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
443.1 
443.1 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-05-03T05_49_55_066Z-debug-0.log
------
Dockerfile:182
--------------------
 180 |     ENV CPPFLAGS=-DPNG_ARM_NEON_OPT=0
 181 |     ENV PACT_SKIP_BINARY_INSTALL=true
 182 | >>> RUN --mount=type=cache,target=/root/.npm,sharing=shared npm clean-install --no-audit --no-fund --registry=$NPM_REGISTRY
 183 |     
 184 |     RUN npm install '@edx/brand@git+https://github.com/<MyOrg>/<MyOrg>-Brand.git'
--------------------
ERROR: failed to solve: process "/bin/sh -c npm clean-install --no-audit --no-fund --registry=$NPM_REGISTRY" did not complete successfully: exit code: 1
Error: Command failed with status 1: docker buildx build --tag=docker.io/overhangio/openedx-mfe:17.0.0 --no-cache --output=type=docker --cache-from=type=registry,ref=docker.io/overhangio/openedx-mfe:17.0.0-cache /home/ubuntu/.local/share/tutor/env/plugins/mfe/build/mfe

The error logs indicated a failure in the Docker build process. Notably, my EC2 instance is equipped with 16 GB RAM, so I do not suspect a resource limitation issue.

I also tried below command as well

tutor local stop
tutor images build mfe --no-cache --no-registry-cache

But the issue is the same.

Could anyone please provide insights or solutions to address this build failure? Any help would be greatly appreciated.

Thank you in advance!

@Mahendra See if this is relevant