Dockerfile for nodejs image build

FROM node:6.9.4 RUN mkdir -p /usr/src/app RUN npm install -g gulp WORKDIR /usr/src/app # Install app dependencies COPY package.json /usr/src/app/ RUN npm install # Bundle app source COPY . /usr/src/app 

I start the image with the command

 docker run -p 3000:3000 -v `pwd`:/data --rm -it nodejs 

Everything starts fine, but I want something when I change any file in the IDE, it also changes inside the running container. How to implement it?

  • It is necessary to use ADD instead of COPY. - KoVadim
  • @KoVadim and how is it different from COPY? - modelfak
  • in any way, either to collect a new image, or to forward through volume - etki
  • @etki can add that back? - modelfak

1 answer 1

You need to roll inside the container the working directory of your project.

 docker run -p 3000:3000 -v `pwd`:/usr/src/app --rm -it nodejs 

And you can also remove the lines

 # Bundle app source COPY . /usr/src/app 
  • Thank you, I just thought about this decision and you have already answered)) - modelfak