Combining ADD and VOLUME on a nodejs Dockerfile
This Dockerfile should contain:

FROM node:6.11-alpine

COPY . /code
WORKDIR /code

RUN npm install -g -s --no-progress yarn &amp;&amp; \
    yarn &amp;&amp; \
    yarn run test &amp;&amp; \
    yarn cache clean

EXPOSE 8080

CMD ["npm", "start"]


COPY copies your current directory to /code for building the final image (that holds compiled code normally).

In your docker-compose.yml, mounting a volume is used for your dev purposes, so that the files modified replace the ones on your image.

version: "3"

services:
  web:
    build: .
    volumes:
      - .:/code
    command: "npm run start:dev"
    ports:
      - "8080:8080"
    networks:
      - internal

networks:
  internal: