Docker node development environment on windows

≯℡__Kan透↙ 提交于 2019-12-06 13:26:10

At least during development, you could share a folder from your windows OS with docker - would make the code-debug cycle a lot quicker.

Mount a Host Directory as a Data Volume: https://docs.docker.com/userguide/dockervolumes/

(about 1/2 way down the page)

Try the following:

FROM node
COPY ./package.json /src
RUN cd /src && npm install
COPY . src/
EXPOSE  3000
CMD ["node", "/src/express.js"]

The way you originally have it will install npm packages everytime you change something within src. If we separate this step, these packages will only be installed if the package.json file changes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!