services: mongodb: image: mongo:7 container_name: zero-knowledge-mongodb ports: - "27017:27017" command: ["mongod", "--replSet", "rs0", "--bind_ip_all"] environment: MONGO_INITDB_DATABASE: zero_knowledge_platform volumes: - mongodb_data:/data/db healthcheck: test: ["CMD", "mongosh", "--quiet", "--eval", "db.runCommand({ ping: 1 }).ok"] interval: 10s timeout: 5s retries: 5 mongodb-init: image: mongo:7 depends_on: mongodb: condition: service_healthy entrypoint: ["bash", "-lc"] command: >- mongosh --host mongodb:27017 --quiet --eval 'try { rs.status() } catch (e) { rs.initiate({_id:"rs0", members:[{_id:0, host:"mongodb:27017"}]}) }' restart: "no" volumes: mongodb_data: