FROM node:15.14.0-buster WORKDIR /usr/app COPY package.json ./ COPY package-lock.json ./ COPY tsconfig.json ./ COPY tsconfig.build.json ./ COPY src ./src COPY resources ./resources RUN npm install RUN npm run build ## this is stage two , where the app actually runs FROM node:15.14.0-buster WORKDIR /usr/app COPY package.json ./ COPY package-lock.json ./ RUN npm install --only=production COPY --from=0 /usr/app/dist . RUN npm install pm2 -g EXPOSE 3000 CMD ["pm2-runtime","src/main.js"]