-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
125 lines (118 loc) · 2.76 KB
/
docker-compose.yml
File metadata and controls
125 lines (118 loc) · 2.76 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
services:
# 1. NestJS Backend (Skeleton or Real)
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: petchain_backend
restart: unless-stopped
ports:
- '3001:4000'
environment:
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/petchain_db
- REDIS_HOST=redis
- REDIS_PORT=6379
- CLAMAV_HOST=clamav
- CLAMAV_PORT=3310
depends_on:
postgres:
condition: service_healthy
clamav:
condition: service_healthy
redis:
condition: service_started
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:4000/health', (r) => {if(r.statusCode!==200)process.exit(1)})"]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
networks:
- petchain_network
# 2. Next.js Frontend
frontend:
build:
context: .
dockerfile: Dockerfile
container_name: petchain_frontend
restart: unless-stopped
ports:
- '3000:3000'
environment:
- NEXT_PUBLIC_API_URL=http://localhost:3001
depends_on:
- backend
networks:
- petchain_network
# 3. Database
postgres:
image: postgres:16-alpine
container_name: petchain_postgres
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: petchain_db
ports:
- '5432:5432'
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- petchain_network
# 4. Redis
redis:
image: redis:7-alpine
container_name: petchain_redis
restart: unless-stopped
ports:
- '6379:6379'
volumes:
- redis_data:/data
command: redis-server --appendonly yes
networks:
- petchain_network
# 5. Database Admin UI
pgadmin:
image: dpage/pgadmin4:latest
container_name: petchain_pgadmin
restart: unless-stopped
environment:
PGADMIN_DEFAULT_EMAIL: admin@petchain.com
PGADMIN_DEFAULT_PASSWORD: admin
ports:
- '5050:80'
depends_on:
- postgres
networks:
- petchain_network
# 6. Antivirus
clamav:
image: clamav/clamav:latest
container_name: petchain_clamav
restart: unless-stopped
ports:
- '3310:3310'
volumes:
- clamav_data:/var/lib/clamav
environment:
CLAMAV_NO_FRESHCLAMD: 'false'
healthcheck:
test: ['CMD', 'clamdscan', '--ping', '3']
interval: 60s
timeout: 10s
retries: 3
start_period: 120s
networks:
- petchain_network
volumes:
postgres_data:
redis_data:
clamav_data:
networks:
petchain_network:
driver: bridge