dockerize mongo database

This commit is contained in:
hyperbel 2023-07-14 12:38:01 +02:00
parent 547561a3ed
commit 4bd35d649b
3 changed files with 18 additions and 0 deletions

2
.gitignore vendored
View File

@ -9,3 +9,5 @@ qr.png
.sums
poetry.lock
*.vim
db/*

13
docker-compose.yml Normal file
View File

@ -0,0 +1,13 @@
version: '3.8'
services:
mongo:
image: mongo
environment:
MONGO_INITDB_DATABASE: partyyy
ports:
- "27017:27017"
volumes:
- ./scripts/init-mongo.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
- ./db/:/data/db/
network_mode: "host"

3
scripts/init-mongo.js Normal file
View File

@ -0,0 +1,3 @@
db = db.getSiblingDB('partyyy');
db.createCollection('mate');
db.createCollection('messages');