Rebuilding MFEs with a custom fork?

I’ve been trying to rebuild the MFEs under quince.1 with a custom fork for some MFEs.

When I try to rebuild the mfe image, I get the following error messages:

Dockerfile:451
--------------------
 449 |     FROM base AS learning-common
 450 |     COPY --from=learning-src /package.json /openedx/app/package.json
 451 | >>> COPY --from=learning-src /package-lock.json /openedx/app/package-lock.json
 452 |     ARG NPM_REGISTRY=https://registry.npmjs.org/
 453 |     
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 488d407c-1d6b-4954-adcc-0845d83a602d::qxb9mxbajyhjwqxnkwaltt9t3: "/package-lock.json": not found
Error: Command failed with status 1: docker buildx build --tag=docker.io/overhangio/openedx-mfe:17.0.0 --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

I had added a plugins with the following contents:

from tutormfe.hooks import MFE_APPS

@MFE_APPS.add()
def _add_my_mfe(mfes):
    mfes["learning"] = {
        "repository": "https://github.com/EDUlib/frontend-app-learning",
        "port": 2000,
    }
    return mfes

This used to work with palm.4 but I am now unable to use it with quince.1.

Any suggestions on how to resolve this issue? Is there something I missed that changed the behaviour in quince.1?

Usually, when I have problems with package-lock.json, I remove it and run npm install to regenerate it, then commit the change to git, reference a new branch to avoid cache, and rebuild mfe.
Also, tutor images build mfe need package-lock.json.

Well, I just ran into the same issue. This error happens in v17.0.0
I took a quick look at the Dockerfile
The line:
RUN git clone {{ app["repository"] }} --branch {{ app.get("version", MFE_COMMON_VERSION) }} --depth 1 .

has been changed to this line:

ADD --keep-git-dir=true {{ app["repository"] }}#{{ app.get("version", MFE_COMMON_VERSION) }} .

I think it might be the cause of the error.

1 Like

so I guess making sure you have “.git” at the end of the repo link will fix the problem.
https://github.com/EDUlib/frontend-app-learning.git
instead of
https://github.com/EDUlib/frontend-app-learning

4 Likes

Thanks @Anh_Vu_Nguy_n that was a very good guess :+1: I added the .git at the end of the repo link and it fixed the build problem.

Kudos to @Anh_Vu_Nguy_n for figuring out the root cause! it really baffled me when I upgraded the tutor-mfe plugin. I failed to add a note about that to the MFE changelog. I’ll do that just now: docs: mention git repo extension in changelog by regisb · Pull Request #178 · overhangio/tutor-mfe · GitHub

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.