Home > Blockchain >  How can I use Rush and Docker volumes together?
How can I use Rush and Docker volumes together?

Time:01-17

I am trying to use Rush to handle a monorepo. I saw a recent, similar question at image of file system with symlinks to all node packages

I am using docker-compose for local dev as I would for any other project. The config is like this:

version: '3'
services:
  web:
    build: .
    image: 'my-image'
    command: "npm start"
    user: "node"
    working_dir: /home/node/app
    volumes:
      - ./:/home/node/app

When I do docker-compose up it can't find any of my dependencies. If I copy the folder to a random location, run npm install, and try the same it works because there are no symlinks.

I was debating doing a volume to the source location of ../../common/temp/node_modules/ but that that might be a bit crazy as it has every node modules for all the packages. The thing is that the files live outside of the folder structure of my server/docker package.

Is there some docker or rush optionality I am missing?

CodePudding user response:

This works, but feels wrong. Hoping another user has a better answer.

volumes:
      - ./src/:/home/node/app/src
      - ../../common/temp/node_modules/:/home/node/app/node_modules

CodePudding user response:

I would guess that you have node_modules in your .dockerignore path, so it is not including the output of your install run from your host. When you do the volume, the empty folder then gets mapped over.

  • Related