Basically I have a main directory and Books Directory (General file structure, there's more but these are the important pieces). So when I fire a request from main to booksServer, it doesn't work because the node modules are missing.
That's because the node modules are inside the docker container at a specific path: '/usr/src/app'
How can I have main.js see that books (service/container) does have the proper node packages inside this specific path?
I think I can use docker-compose, but I wanted to test it individually without docker-compose first.
**-Main Directory (Individual Service, has its own container)**
-Initiator (Fires commands)
-DockerFile
**-Books Directory (Individual Service, has its own container)**
-Stubs
-BooksStub.js (NEED THIS!, but it won't work because needs npm modules which is located in its container @/usr/src/app. How can I access the nodemodules that it's using?)
-booksServer.js
-Package*.json (lock and package.json)
-DockerFile
Inside the
Error:
internal/modules/cjs/loader.js:800
throw err;
^
Error: Cannot find module 'grpc'
Books Dockerfile
FROM node:12.14.0
WORKDIR /usr/src/app
COPY package*.json ./
COPY . /usr/src/app
RUN npm install
EXPOSE 30043
CMD ["node", "booksServer.js"]
Main DockerFile
FROM node:12.14.0
WORKDIR /usr/src/app
COPY package*.json ./
COPY . /usr/src/app
RUN npm install
EXPOSE 4555
CMD ["node", "main.js"]