julkascript / cardflow

The open-source Trading Card Game market
MIT License
14 stars 9 forks source link

Map the node_modules folder from container to host #77

Closed milensski closed 7 months ago

milensski commented 7 months ago

This PR is targeting issue #73 .

To achieve this task I have used a simple solution by setting the storage location of the volume to correspond with the node_modules directory of the host. To do this, a named volume with a local driver and a bind mount has been utilized.

Synchronizing the node_modules folder from the container to the host is established at creating the container with docker compose. Please note that this action is time consuming and it used around 500sec to be created.

[!NOTE] My suggestions is to delete the current node_modules folder and then start this process because otherwise might not sync as intended.

Please test it and let me know if you approve this approach.

julkascript commented 7 months ago

I receive an error at build time: image

Error response from daemon: ./frontend/node_modules is not an absolute path

I have deleted the node_modules folder at the frontend and also cleaned my docker cache. Is it just me? @milensski @dinocom33

dinocom33 commented 7 months ago

I successfully build the images and ran the containers. There were no errors.

image

julkascript commented 7 months ago

I successfully build the images and ran the containers. There were no errors.

image

Do you see the node modules locally in frontend/node_modules?

dinocom33 commented 7 months ago

I successfully build the images and ran the containers. There were no errors. image

Do you see the node modules locally in frontend/node_modules?

Yes. The modules are there.

image

julkascript commented 7 months ago

So I was able to resolve the error, I guess I had cached stuff or something else. However, I still don't see the node_modules locally in my /frontend/node_modules.

@milensski if you delete the node_modules folder, and then you docker compose up, are the node modules appearing locally?

milensski commented 7 months ago

So I was able to resolve the error, I guess I had cached stuff or something else. However, I still don't see the node_modules locally in my /frontend/node_modules.

@milensski if you delete the node_modules folder, and then you docker compose up, are the node modules appearing locally?

@julkascript Yes, i delete the node_modules folder, the container and the volume and after docker compose up -d everything is created again. I have tried 2 times today and it worked. image

The error on the picture you shared indicates problems with absolute path, is it something with the OS setup ? The relative path is used to map the locally created volume with the container to the specified path so they can be placed in the right folder frontend/

 Line 82:     device: ./frontend/node_modules