-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
78 lines (72 loc) · 1.64 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
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
version: '3'
# docker rm $(docker ps -a -q) && docker volume prune -f
services:
reddit:
container_name: redditclone
build:
context: .
args:
PORT: ${APP_PORT:-8081}
APP_NAME: ${APP_NAME}
BUILD_DATE: $(date -u +"%Y%m%d%H%M%SZ")
ports:
- 8081:${APP_PORT:-8081}
expose:
- ${APP_PORT:-8081}
env_file:
- .env
depends_on:
mysql:
condition: service_healthy
mongodb:
condition: service_healthy
redis:
condition: service_healthy
restart: on-failure
volumes:
- "./internal/config/config.yaml:/app/config.yaml"
- "./static/:/app/static/"
- "./docs/:/app/docs/"
mysql:
image: mysql:8
container_name: MySQL
command: --mysql-native-password=ON
env_file:
- .env
ports:
- 3306:${MYSQL_PORT:-3306}
volumes:
- './init/db_tables/:/docker-entrypoint-initdb.d/'
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
retries: 5
timeout: 10s
mongodb:
image: mongo:5
container_name: MongoDB
env_file:
- .env
ports:
- "27017-27019:${MONGO_PORT:-27017-27019}"
volumes:
- mongo_data:/data/db
healthcheck:
test: ["CMD","mongosh", "--eval", "db.adminCommand('ping')"]
interval: 10s
retries: 5
timeout: 10s
redis:
image: redis
container_name: Redis_cache
ports:
- 6379:${REDIS_PORT:-6379}
env_file:
- .env
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 10s
retries: 5
timeout: 10s
volumes:
- mongo_data: