-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
101 lines (95 loc) · 2.25 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
101 lines (95 loc) · 2.25 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
services:
# PostgreSQL Database
postgres:
image: postgres:16-alpine
container_name: hakolr-postgres
restart: unless-stopped
env_file:
- .env.production
environment:
POSTGRES_DB: ${DB_NAME:-hakolr_blog}
POSTGRES_USER: ${DB_USER:-postgres}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- hakolr-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
# Backend (NestJS)
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: hakolr-backend
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
env_file:
- .env.production
environment:
NODE_ENV: production
PORT: 3001
DB_HOST: postgres
DB_PORT: 5432
networks:
- hakolr-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3001/api"]
interval: 30s
timeout: 10s
retries: 3
# Frontend (Next.js)
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: hakolr-frontend
restart: unless-stopped
env_file:
- .env.production
depends_on:
- backend
environment:
NODE_ENV: production
networks:
- hakolr-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
interval: 30s
timeout: 10s
retries: 3
# Nginx Reverse Proxy
nginx:
image: nginx:alpine
container_name: hakolr-nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/ssl:/etc/nginx/ssl:ro
- nginx_cache:/var/cache/nginx
depends_on:
- frontend
- backend
networks:
- hakolr-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80/health"]
interval: 30s
timeout: 10s
retries: 3
volumes:
postgres_data:
driver: local
nginx_cache:
driver: local
networks:
hakolr-network:
driver: bridge