Add MongoDB service to docker-compose

This commit is contained in:
Mr. Algorithm 2025-10-12 18:36:35 +05:30 committed by GitHub
parent 973e1d65ae
commit 53d26a8693
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 0 deletions

View File

@ -6,3 +6,25 @@ services:
env_file: env_file:
- .env - .env
restart: unless-stopped restart: unless-stopped
depends_on:
- mongodb
mongodb:
image: mongo:7
container_name: mongodb
restart: unless-stopped
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
ports:
- "27017:27017"
volumes:
- mongo-data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
volumes:
mongo-data: