-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
152 lines (149 loc) · 3.43 KB
/
docker-compose.yml
File metadata and controls
152 lines (149 loc) · 3.43 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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
services:
api:
build:
context: api
dockerfile: Dockerfile
container_name: api
hostname: api
env_file:
- .env
environment:
PORT: ${API_PORT}
REDIS_URL: ${REDIS_URL}
DB_HOST: ${DB_HOST}
DB_NAME: ${DB_NAME}
depends_on:
- mongodb
secrets:
- redis_password
- mongo_root_password
- mongo_root_username
networks:
- mongodb_network
- api_network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:$API_PORT/health"]
interval: 30s
timeout: 10s
retries: 3
logging:
driver: "local"
options:
max-size: "10m"
max-file: "3"
mongodb:
image: mongo:latest
container_name: mongodb
hostname: mongodb
volumes:
- mongodb-data:/data/db/
- mongodb-log:/var/log/mongodb/
- ./database/mongo-entrypoint.sh:/docker-entrypoint-initdb.d/mongo-entrypoint.sh:ro
secrets:
- mongo_root_username
- mongo_root_password
entrypoint: ["/bin/bash", "/docker-entrypoint-initdb.d/mongo-entrypoint.sh"]
networks:
- mongodb_network
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 30s
timeout: 10s
retries: 3
logging:
driver: "local"
options:
max-size: "10m"
max-file: "3"
client:
build:
context: client
dockerfile: Dockerfile
container_name: client
hostname: client
env_file:
- .env
environment:
VITE_PORT: ${CLIENT_PORT}
VITE_API_URL: ${API_URL}
networks:
- api_network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:$CLIENT_PORT"]
interval: 30s
timeout: 10s
retries: 3
logging:
driver: "local"
options:
max-size: "10m"
max-file: "3"
cache:
image: redis:6.2-alpine
container_name: cache
hostname: cache
restart: always
entrypoint: ["/usr/local/bin/redis-entrypoint.sh"]
volumes:
- cache:/data
- ./cache/redis.conf.template:/etc/redis/redis.conf.template:ro
- ./cache/redis-entrypoint.sh:/usr/local/bin/redis-entrypoint.sh:ro
networks:
- api_network
secrets:
- redis_password
healthcheck:
test: ["CMD", "sh", "-c", "redis-cli -a \"$(cat /run/secrets/redis_password)\" ping"]
interval: 30s
timeout: 10s
retries: 3
logging:
driver: "local"
options:
max-size: "10m"
max-file: "3"
nginx-proxy:
image: nginx:latest
container_name: nginx-proxy
hostname: nginx-proxy
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- "80:80"
networks:
- api_network
depends_on:
- client
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80"]
interval: 30s
timeout: 10s
retries: 3
logging:
driver: "local"
options:
max-size: "10m"
max-file: "3"
volumes:
mongodb-data:
driver: local
name: mongo-data
mongodb-log:
driver: local
name: mongo-log
cache:
driver: local
networks:
mongodb_network:
driver: bridge
name: mongo-network
api_network:
driver: bridge
name: api-network
secrets:
redis_password:
file: ./secrets/redis_password.txt
mongo_root_username:
file: ./secrets/mongo_root_username.txt
mongo_root_password:
file: ./secrets/mongo_root_password.txt