Is your feature request related to a problem? Please describe.
The problem is related to the efficiency in the nodejs image building process when we choose to develop/contribute using docker-compose.
I realized that in the current dockerfile there is only one layer responsible for copying all code from the current directory into the container. This results in the need to rebuild the image from this layer whenever any part of the code is changed, which can lead to unnecessary waiting for the npm install process in cases where dependencies have not changed.
Describe the solution you'd like
One possible way to solve this is to separate the layers where the source code and package.json / package-lock.json are copied into the container. Also, copy the remaining source code only after the npm install process. Thus the dependencies will only be reinstalled when new dependencies are changed / added.
Describe alternatives you've considered
Another possibility of improvement is the addition of a docker-compose volume containing the source code, this would allow behavior similar to a hot reloading.
Additional context
Of course, all these suggestions made here are subject to discussion, because I may not be fully aware of the reasons why they are not currently implemented, even though they seems to be simple.
why they are not currently implemented, even though they seems to be simple.
Because I'm a Docker noob. I'm new to Docker and all it's functionalities. It would be great if you could shoot up a PR! I'm still learning Docker, I'll review and merge to master 馃憤
why they are not currently implemented, even though they seems to be simple.
Because I'm a Docker noob. I'm new to Docker and all it's functionalities. It would be great if you could shoot up a PR! I'm still learning Docker, I'll review and merge to master
Thanks for replying, i will do it then! It will be a pleasure to help.