feat: add persistent database volume to Dockerfile and docker-compose.yml

This commit is contained in:
2026-08-10 08:07:23 +00:00
parent 7b2de130e1
commit 223f8b01ab
3 changed files with 15 additions and 0 deletions
+4
View File
@@ -1,6 +1,10 @@
#!/usr/bin/env bash
set -e
# Ensure permissions on volume and logs directory
mkdir -p /data/db /var/log/mongodb /var/run/mongodb
chown -R mongodb:mongodb /data/db /var/log/mongodb /var/run/mongodb
echo "Starting local MongoDB server (only accessible from inside container)..."
# Start mongod as the default mongodb user, bound to localhost (127.0.0.1) for internal access only
su -s /bin/bash -c "mongod --dbpath /data/db --bind_ip 127.0.0.1 --fork --logpath /var/log/mongodb/mongod.log" mongodb