Docker Community Forums

Share and learn in the Docker community.

Best practice for developing a nodeJS app on windows


(Befree) #1

I’m developing a simple NodeJS application. I use docker and it makes it very easy to deploy to production.
This is my Dockerfile:

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

On my development environment (windows, boot2Docker) Docker is slowing me down, because for every small change I do, I have to re-build the Docker image and run the container and it takes a few minutes.

I couldn’t find a way to simply copy my source files from the host to the docker container after I change them. Is there an easy way to do it? Should I use plain nodeJS on my development environment and only use Docker in production?

Thanks!


(Andy Rothfusz) #2

In the special case of boot2docker, there is a shared directory between your PC and the VirtualBox VM. You could docker run -v to mount this shared volume into the container and so run your code directly, without copying. Then use docker build when you’re ready to create a static image for testing or production.