1
MrMarco
3y

Is it just me or do Nodejs apps just completely hate to be Dockerized?

Comments
  • 0
    What?
    Nodejs apps are meant to be dockerized.
  • 0
    @magicMirror I am finding the whole node_modules thing to use insane amounts of CPU when it's Dockerized, even more than usual. And the hot reloading is buggy and it sucks
  • 0
    @MrMarco you shouldn't a hot reload in a dockerized app

    Docker is meant for deploys, not for development
  • 0
    Yeesh. 🤦‍♂️.

    You can use Docker to develop nodejs. just map the project directory on the host, to the docker.
    Thrn restart the server as required. Hot reload is nice option when you work like that, and any changes to the node modules that you do inside the container will be persisted.
  • 0
    I just set this up with webpack, so here's a few lessons I learned:
    1. When you want hot reload, proxy everything you don't recognize to WDS after routing the api and such.
    2. Turn node_modules into its own volume that isn't a host directory, so that docker can be efficient with the caching. (I only suspect this is the cause but directory mounts are about half as fast for me)
    3. Check for permission errors, there's a lot of them.
  • 0
    Also use a static file server other than node. A caddy config to serve file if exists else proxy is like 4 lines.
Add Comment