Home > Enterprise >  Weird command in dockerfile
Weird command in dockerfile

Time:05-26

Can anyone explain this command?

CMD [ -d "node_modules" ] && npm run start || npm ci && npm run start

CodePudding user response:

If a directory named node_modules exists, then run npm run start. Else run npm ci and then npm run start.

The objective is to only run npm ci if node_modules doesn't exist.

CodePudding user response:

Basically -d tests for directory existence and runs npm run start, otherwise it will run npm ci && npm run start

  • Related