0

I have a node container that is running nodemon. I have a windows and mac dev laptop. Due to issues outlined here https://stackoverflow.com/a/39239884/2532762, the windows machine has to fallback on a very innefficient polling method to watch for changes. But I want to leave any unix style hosts to run without a flag. I want the container to run one of 2 scripts depending on the host OS.

I can't find a proper way to access this information from within the container.

This is the gist of the script I want to use

const dockerHostIsWindows = "" //<---??

const pollingFlag = dockerHostIsWindows ? "--legacy-watch --polling-interval 1000" : ""
const command = `../node_modules/.bin/nodemon ${pollingFlag} --config nodemon.json --inspect=0.0.0.0:9229 ./server.ts`

const child = exec(command, { cwd: __dirname }, (error, stdout, stderr) => {
})
1mike12
  • 2,946
  • 3
  • 27
  • 36
  • Instead of building an isolated Docker Linux-native container that has heavy dependencies on the surrounding host operating system, would it be easier to install Node directly on the host? At least on MacOS with Homebrew that's a simple `brew install node`. – David Maze Nov 06 '22 at 00:48

0 Answers0