tudorconstantin / knests

Full-stack boilerplate (project/hackathon starter) with Docker/NodeJS/Typescript/GraphQL/React/Material-UI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Npm install without rebuilding image?

twigs67 opened this issue · comments

Hey,

Great package! I'm still going through it and disclaimer, I've only been messing around with Docker for a couple of months, but is there any way that you know if to add npm packages without rebuilding the image? Not within your package, but in general?

It's a real drag having to rebuild the image every time you add a new image in dev.

Thanks

Yes, it is possible to have the container use the same node_modules as the host, BUT (and that is a really big but ):

  • you tie the dev OS to the OS the app will run in
  • you might not be able to use modules that use native libraries? because they'll need those libraries in the container too

The above are enough for a no go from me.

Also, I wanted to make sure that the same image used in development will be used when deployed in production, including OS, node version, library versions, etc, to avoid the countless headaches the incompatibilities between them can generate.

Given the relatively small number of times I install a new library and the peace of mind this whole architecture brings, I think the current setup is a good enough compromise between ease of use and good practices.

That makes sense. I usually only do a lot of installing at the beginning of a project, so it's not that big of a deal. Thanks for the detailed response.