Open DawoudSheraz opened 4 months ago
I conclude to two solutions:
While mounting, add this line in the volume: /openedx/app/node_modules
. This line will make node_modules a volume (It won't call binding). Link to StackOverflow
authn: # Work on this MFE for development
image: "docker.io/overhangio/openedx-authn-dev:18.0.0"
...
volumes:
- ../plugins/mfe/apps/mfe/webpack.dev-tutor.config.js:/openedx/app/webpack.dev-tutor.config.js:ro
- /host-machine-path/.../frontend-app-authn:/openedx/app
- /openedx/app/node_modules # here, we're ignoring node_modules
...
npm i package-name
won't work if it is done in the host-machine.package.json
has different dependencies than those at image build time, users need to run npm i
in the container by themselves.As @DawoudSheraz mentioned this method above, we can install node_modules in the host machine project folder after the mounting process (this is binding; we are binding our host machine files to container files).
npm i
after the mounting process because the dependencies will be installed from the package.json of the user's forked project.Feel free to share if you have any other method to tackle this thing.
@hinakhadim For solution 1, when will the very first install after the mount happen? Will it be done manually inside container?
@hinakhadim For solution 1, when will the first install after the mount happen? Will it be done manually inside container?
tutor dev start
package.json
of the cloned repo are similar to packages mentioned in package.json
of openedx/frontend-app-*
. Then, the container will start successfully.By using solution 1, we will not face fedx-scripts not found
error. In volumes, the line /openedx/app/node_modules
ignores node_modules
mounting. It means the whole app will mount to /openedx/app
and node_modules
folder will not mount. As a result, installed node_modules
(from the MFE image) will be used.
node_modules
by running npm install
in cloned repo.tutor dev start
and the MFE container will be up.@arbrandes @regisb any suggestions are highly appreciated.
I think the answer is to run npm clean-install
as part of run tutor dev launch
. One "mfe" init tasks could take care of running that command, as it is done in the LMS: https://github.com/overhangio/tutor/blob/master/tutor/templates/jobs/init/mounted-directories.sh
This issue is a similar issue to https://github.com/overhangio/tutor/issues/997. The steps to reproduce are:
fedx-script not found
Like the mentioned issue in tutor core, the bind-mounted MFE during image build does not get node_modules copied back to host. When running tutor, the host MFE directory without node_modules overrides the installed node_modules within image, thus resulting in fedx-script not found.