File size: 753 Bytes
fc69895
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# For development only
# Set MONGODB_URL=mongodb://localhost:27017 in .env.local to use this container
services:
  mongo:
    image: mongo:8
    hostname: mongodb
    ports:
      - ${LOCAL_MONGO_PORT:-27017}:27017
    command: --replSet rs0 --bind_ip_all #--setParameter notablescan=1
    mem_limit: "5g"
    mem_reservation: "3g"
    healthcheck:
      # need to specify the hostname here because the default is the container name, and we run the app outside of docker
      test: test $$(mongosh --quiet --eval 'try {rs.status().ok} catch(e) {rs.initiate({_id:"rs0",members:[{_id:0,host:"127.0.0.1:${LOCAL_MONGO_PORT:-27017}"}]}).ok}') -eq 1
      interval: 5s
    volumes:
      - mongodb-data:/data/db
    restart: always

volumes:
  mongodb-data: