U
U
UncleDenn2019-02-04 19:47:53
JavaScript
UncleDenn, 2019-02-04 19:47:53

How to set up docker?

Hello!
I'm trying to set up docker to work with a project on mern
, this is how the docker configs docker
-compose.yml look like

version: '3'
services:
  app:
    container_name: node_app
    restart: always
    build: .
    ports:
      - '80:8080'
    links:
      - mongo
  mongo:
    container_name: mongo
    image: mongo
    ports:
      - '27017:27017'

Dockerfile
FROM node:10

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 8080

CMD ["npm", "start"]

The question is how to configure docker so that if I make changes to my api or to any file, they are immediately applied?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2019-02-04
@ulkoart

volumes:
      - .:/code

in docker-compose.yml you need to mount the directory with the code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question