Docker Dev Environment with Nodemon and Mongo DB



1 Install Docker  Community ediction and Composer

https://blog.codeship.com/using-docker-compose-for-nodejs-development/

2 . Sampe application resides in server folder which have the package.json file

  • ensure package.json  has script.  "start": "nodemon -L index.js"
  • ensure nodemon.json exhist

3. touch Dockerfile.

FROM node:8.1.0-alpine
RUN mkdir /server

RUN npm install nodemon -g

ADD ./server /server
WORKDIR /server
RUN npm install

#ADD server/nodemon.json /server/nodemon.json

EXPOSE 3000

CMD npm start

5. docker-compose build

6.touch docker-compose.yml


version: '2'
services:
  web:
    build: .
    volumes:
    - "./server:/server"
    ports:
      - "3000:3000"
    links:
      - mongo
  mongo:
    image: mongo:3.4.4
    container_name: mongo
    ports:
      - "27017:27017"


7.docker-compse up. application runs in localhost port 3000



Comments

Popular posts from this blog

ENOENT: no such file or directory, rename : node_modules/async

react-quill Integrate quill-image-resize-module