-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
38 lines (38 loc) · 1.48 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
version: '3.7'
services:
server:
build: ./server
restart: always
container_name: server
ports:
- "${SERVER_PORT}:${SERVER_PORT}"
volumes:
- ./server:/server
environment:
- SERVER_PORT=${SERVER_PORT}
- MONGO_CONNECTION_STRING=${MONGO_CONNECTION_STRING}
# script to wait for mongo to be fully up & running
- WAIT_HOSTS=db:${MONGO_PORT}
depends_on:
- db
restart: on-failure
db:
image: mongo:latest
volumes:
- $DATABASE_DATA:/$DATABASE_DATA
# Put the script to initialise the database in the right directory withing mongo container
# It will execute it on initialisation
- ./init-db.js:/docker-entrypoint-initdb.d/init-db.js:ro
environment:
# to connect from cmd line run (read / write user) for root access use root user
# mongo --port 27017 -u "user" -p "password" --authenticationDatabase "db"
# Note : it seems these don't work properly and users are set through the init script
# in the volumes section.
- MONGO_INITDB_DATABASE=${MONGO_INITDB_DATABASE}
- MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD}
ports:
- "${MONGO_PORT}:${MONGO_PORT}"
restart: on-failure
expose:
- ${MONGO_PORT}