Files
freeCodeCamp/api/tools/docker-compose.yml
Shaun Hamilton 568840b8d8 feat(api): exam date use + split prisma files (#62344)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2025-10-02 14:28:36 +02:00

35 lines
787 B
YAML

services:
db:
image: mongo
container_name: mongodb
command: mongod --replSet rs0
restart: unless-stopped
ports:
- 27017:27017
volumes:
- db-data:/data/db
healthcheck:
test: ['CMD', 'mongosh', '--eval', "db.adminCommand('ping')"]
interval: 2s
retries: 5
setup:
image: mongo
depends_on:
db:
condition: service_healthy
restart: on-failure
# This will try to initiate the replica set, until it succeeds twice (i.e. until the replica set is already initialized)
command: >
mongosh --host db:27017 --eval '
try {
rs.initiate();
} catch (err) {
if(err.codeName !== "AlreadyInitialized") throw err;
}
'
volumes:
db-data:
driver: local