Install node_modules inside Docker container and synchronize them with host

前端 未结 10 1377
旧巷少年郎
旧巷少年郎 2020-12-12 11:33

I have the problem with installing node_modules inside the Docker container and synchronize them with the host. My Docker\'s version is 18.03.1-ce, build

10条回答
  •  独厮守ぢ
    2020-12-12 12:14

    Thanks Vladyslav Turak for answer with entrypoint.sh where we copy node_modules from container to host.

    I implemented the similar thing but I run into the issue with husky, @commitlint, tslint npm packages.
    I can't push anything into repository.
    Reason: I copied node_modules from Linux to Windows. In my case <5% of files are different (.bin and most of package.json) and 95% are the same. example: image with diff

    So I returned to solution with npm install of node_modules for Windows first (for IDE and debugging). And Docker image will contain Linux version of node_modules.

提交回复
热议问题