简体   繁体   中英

Ignoring every `node_modules` in a docker volume

I am trying to ignore every node_modules in every workspaces / sub folders.

The fact is : it is impossible to (really) ignore a folder by its name in a volume.

So there was this trick :

volumes:
  - ./:/app
  - /app/node_modules

It works well for apps that have one single node_modules . But what if there is multiple one like in the bellow directory tree ?

project
|   node_modules/
|   docker-compose.yml
|   Dockerfile
|
└─── workspaces/
|   └─── client/
|       |   node_modules/
|   |
|   └─── server/
|       |   node_modules/

Do I need really need to mount every node_modules as a volume in my docker-compose.yml ?

volumes:
  - ./:/app
  - /app/node_modules
  - /app/workspaces/client/node_modules
  - /app/workspaces/server/node_modules

Or is there another better way ?

rewrite as "*node_modules"
hopefully it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM