Docker Ignore is not woking well with docker compose and my file structure

后端 未结 3 611
走了就别回头了
走了就别回头了 2021-02-06 13:21

I\'am setting up a new dockerfile and docker-compose.yml. I\'ll below show first my file structure with rails and I want to use a new .dockerignore to ignore node_modul

3条回答
  •  -上瘾入骨i
    2021-02-06 13:52

    Per this related answer you can mount your main directory but ignore the node_modules using a second anonymous volume in the docker-compose.yml. This allows you to mirror your directory but the container should keep its own node_modules.

    volumes:
      - .:/var/www/${APP_NAME}_web
      - /var/www/${APP_NAME}_web/node_modules/
    

提交回复
热议问题