'How do I maintain a folder structure in dockerfile
I'm trying to move my nestjs app into container. But I met some problems. I used grpc in my project and my proto files are stored in a protos folder which is the same level as the src folder. My file structure is like this.
-project folder
--protos
---...proto files
--src
---...other codes
And in my docker file, I copied the proto folders, however, when I run the docker-compose up, it shows it cannot find my proto files. But if I just go with npm run start, it runs normally. Here is my dockerfile:
FROM node:14 AS builder
# Create app directory
WORKDIR /app
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./
COPY prisma ./prisma/
COPY protos ./protos/
# Install app dependencies
RUN npm install
COPY . .
RUN npm run build
FROM node:14
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/protos ./protos
EXPOSE 5273
CMD [ "npm", "run", "start:dev" ]
enter code here
Am I missing something here? Any advises will be appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
