Getting this type of errors on docker build for
Step 5/10 : RUN npm run build
Cannot find module '@app/common/constants' or its corresponding type declarations import { jwtConstants } from '@app/common/constants';
but the nest build command works fine on local machine.
Dockerfile
FROM node:18-alpine as build
WORKDIR /usr/share/app-gateway
COPY . ./
RUN npm ci --omit=dev
RUN npm run build
FROM node:18-alpine
WORKDIR /usr/share/app-gateway
COPY --from=build /usr/share/app-gateway .
EXPOSE 3000
su
CMD ["node", "apps/app-gateway/src/main.js"]`
how the nestjs build correclty in local but not in docker?
I want to make services build independently and should be able to deploy ,
node /dist/path_to_main/main.js
was running fine in local machine but the nest build is failing in dockerfile.