version: "3" services: server: build: context: . dockerfile: ./Dockerfile target: server depends_on: - mongo environment: - NODE_DB_URI=mongodb://mongo/habitica?replicaSet=rs # this only needs to be adapted if using a separate database - BASE_URL=http://127.0.0.1:8080 # change this to the URL under which your instance will be reachable - INVITE_ONLY=false # change to `true` after registration of initial users, to restrict further registrations networks: - habitica ports: - "3000:3000" mongo: image: docker.io/mongo:latest restart: unless-stopped hostname: mongo command: ["--replSet", "rs", "--bind_ip_all", "--port", "27017"] healthcheck: test: echo "try { rs.status() } catch (err) { rs.initiate({_id: 'rs', members: [{ _id: 0, host: 'mongo:27017' }]}) }" | mongosh --port 27017 --quiet interval: 10s timeout: 30s start_period: 0s start_interval: 1s retries: 30 volumes: - ./mongodb-data/db:/data/db:rw,Z - ./mongodb-data/dbconf:/data/configdb:Z networks: habitica: aliases: - mongo networks: habitica: driver: bridge