Files
freeCodeCamp/.devcontainer/docker-compose.yml
2026-02-08 12:20:52 +05:30

42 lines
882 B
YAML

services:
devcontainer:
image: ghcr.io/freecodecamp/devcontainer:latest
depends_on:
- db
- setup
volumes:
- ..:/workspaces/freeCodeCamp:cached
network_mode: service:db
command: sleep infinity
db:
image: mongo:8.0
command: mongod --replSet rs0
restart: unless-stopped
hostname: mongodb
volumes:
- db-data:/data/db
healthcheck:
test: ['CMD', 'mongosh', '--eval', "db.adminCommand('ping')"]
interval: 2s
retries: 5
start_period: 10s
setup:
image: mongo:8.0
depends_on:
db:
condition: service_healthy
restart: on-failure:5
command: >
mongosh --host mongodb:27017 --eval '
rs.initiate({
_id: "rs0",
members: [{ _id: 0, host: "mongodb:27017" }]
}).ok || rs.status().ok
'
volumes:
db-data:
driver: local