在dockerfile中运行npm install后,node_modules不可用

我尝试为我的节点应用程序创build一个dockerfile。 但运行npm后,我看到

在7.966s添加了160个包

但我没有看到该文件夹​​中的node_modules,当我启动应用程序,我看到node_moduls丢失=>docker不工作

这是我的dockerfile

FROM keymetrics/pm2:latest # create app directory in container #RUN mkdir -p /app # set /app directory as default working directory WORKDIR /app # only copy package.json initially so that `RUN npm start` layer is recreated only # if there are changes in package.json ADD dist/package.json /app/ ENV MONGO_HOST=mongodb://localhost/chronas-api ENV MONGO_PORT=27017 ENV PORT=80 RUN npm install --production # copy all file from current dir to /app in container COPY dist /app/ #RUN npm install --production RUN ls -al -R # expose port 80 EXPOSE 80 CMD [ "pm2-docker", "start", "index.js" ] 

这里是完整的代码https://github.com/daumann/chronas-api/tree/azure