-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
94 lines (86 loc) · 1.89 KB
/
docker-compose.yaml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
version: '3.8'
services:
db1:
image: mongo:6
container_name: mongo
restart: always
ports:
- '27017:27017'
env_file:
- db1.env
volumes:
- mongodata:/data/db:rw
# below command is just to stop mongo flooding the terminal with it's logs
command:
- '--logpath'
- '/var/log/mongodb/mongod.log'
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/productiondb --quiet
interval: 10s
timeout: 2s
retries: 5
db2:
image: postgres:15
restart: always
container_name: postgres
user: postgres
env_file:
- db2.env
ports:
- '5438:5432'
volumes:
- ./01.sql:/docker-entrypoint-initdb.d/01.sql
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
api:
restart: on-failure
container_name: api
env_file:
- db2.env
- db1.env
- jwt.env
build:
context: .
dockerfile: ./Dockerfile_api
image: python:3.10
ports:
- '8000:8000'
volumes:
- .:/code
depends_on:
db1:
condition: service_healthy
db2:
condition: service_healthy
healthcheck:
test: curl --fail http://localhost:8000/health || exit 1
interval: 10s
timeout: 2s
retries: 5
# for console info
tty: true
stdin_open: true
api-caller:
# restart: on-failure
container_name: api-caller
image: alpine:3.17.3
env_file:
- node_auth.env
- db2.env
build:
context: .
dockerfile: ./Dockerfile_api_caller
depends_on:
api:
condition: service_healthy
# for console info
tty: true
stdin_open: true
volumes:
# this will store the db data in /var/lib/docker/volumes, pretty neat
pgdata:
mongodata: