This repository was archived by the owner on Oct 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
61 lines (61 loc) · 1.59 KB
/
docker-compose.yaml
File metadata and controls
61 lines (61 loc) · 1.59 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
version: '3.9'
services:
# main backend container
app:
# in development process, shuts down the container that may have any issue
# and let developers to inspect this in detail.
restart: on-failure:2 # give 2 chances
build:
# find dockerfile from root
context: .
# in development process, do not bundle code
# to make it easier to inspect
target: build
environment:
# run as production mode
- NODE_ENV=production
# use external DB url,
# instead of localhost
- DATABASE_URL=${DATABASE_URL_PROD}
- JWT_SECRET
- WORKDIR=/usr/src/app
# - PORT=80 # default
ports:
# default 80, so expose it to safe port
- 8888:80
networks:
- db-connection
depends_on:
- db
db:
restart: always
# use default ports
# you can override this with environment variable
build:
context: .
dockerfile: ./mongodb.Dockerfile
# /mongodb_replica
volumes:
# default to data
# you can override this volume with environment variable
- type: volume
source: ${DB_VOLUME:-data}
target: /data:db
# pass environment variable
environment:
# passing initial authentication setup
- MONGO_INITDB_ROOT_USERNAME
- MONGO_INITDB_ROOT_PASSWORD
# MUST be same as service name
- MONGO_REPLICA_HOST=db
- MONGO_REPLICA_PORT=${DB_PORT:-27017}
networks:
- db-connection
ports:
- ${DB_PORT:-27017}:27017
volumes:
# persistent data volume for database
data:
networks:
db-connection:
driver: bridge