Docker: Approaches for watching files and restarting container processes
Are there any workable approaches to watch/reload within docker?
The use case here is development, where switching between branches may change one or more of backend, frontend or database provisioning files.
Example: I have a node.js application. If server JS code changes, I want the backend server to restart. If
package.json changes, I want the “install” container (runs
npm install, saving
node_modules to a shared Volume). If SQL files change, I want the provisioning container to run its
psql commands again.
Basically, I want to watch certain files and restart the process if they change (container itself is not technically restarted). Supervisord isn’t cut out for watching, but seems like process managers like PM2 or Forever would normally be the slam dunk choice if it weren’t for the docker consideration.