From e58bbcccb46b492ab6abf05de8d15d1fb11f0598 Mon Sep 17 00:00:00 2001 From: FabricSoul Date: Wed, 16 Jul 2025 01:31:20 -0400 Subject: [PATCH] add docker compose file with mongodb configured --- docker-compose.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1a1a7a5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,36 @@ +services: + mongo: + image: mongo + container_name: mongo + restart: unless-stopped + + # ---------- credentials ---------- + environment: + MONGO_INITDB_ROOT_USERNAME: ${MONGO_ROOT_USER} + MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD} + + # ---------- persistence ---------- + volumes: + # primary data store + - mongo_data:/data/db + # (optional) replica‑set metadata; small but useful to persist + - mongo_cfg:/data/configdb + # seed scripts for first‑run init (create users, seed collections, etc.) + - ./mongo/init:/docker-entrypoint-initdb.d:ro + + # ---------- networking ---------- + # Only published when the 'dev' profile is active + ports: + - "${MONGO_PORT}:27017" + + # ---------- basic health check ---------- + healthcheck: + test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping')"] + interval: 30s + timeout: 10s + retries: 5 + +# ---------- named volumes ---------- +volumes: + mongo_data: + mongo_cfg: