compose.yaml
 1  # Comments are provided throughout this file to help you get started.
 2  # If you need more help, visit the Docker compose reference guide at
 3  # https://docs.docker.com/compose/compose-file/
 4  
 5  # Here the instructions define your application as two services called "todo-app" and “todo-database”
 6  # The service “todo-app” is built from the Dockerfile in the /app directory,
 7  # and the service “todo-database” uses the official MongoDB image 
 8  # from Docker Hub - https://hub.docker.com/_/mongo. 
 9  # You can add other services your application may depend on here.
10  
11  services:
12    todo-app:
13      build:
14        context: ./app
15      depends_on:
16        - todo-database
17      environment:
18        NODE_ENV: production
19      ports:
20        - 3000:3000
21        - 35729:35729
22      develop:
23        watch:
24          - path: ./app/package.json
25            action: rebuild
26          - path: ./app
27            target: /usr/src/app
28            action: sync
29  
30    todo-database:
31      image: mongo:6
32      volumes: 
33        - database:/data/db
34      ports:
35        - 27017:27017
36  
37  volumes:
38    database: