-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcompose.deploy.yml
More file actions
145 lines (136 loc) · 4.31 KB
/
Copy pathcompose.deploy.yml
File metadata and controls
145 lines (136 loc) · 4.31 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
version: "3.8"
# OctoDocs 프로덕션 배포용 Docker Compose
# compose.local.yml 기반, octodocs.site 도메인 사용
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- net
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
interval: 10s
timeout: 5s
retries: 5
restart: always
redis:
image: redis:latest
environment:
REDIS_HOST: ${REDIS_HOST}
REDIS_PORT: ${REDIS_PORT}
networks:
- net
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
retries: 3
start_period: 10s
timeout: 5s
restart: always
backend:
build:
context: .
dockerfile: ./services/backend/Dockerfile.local
image: backend:latest
env_file:
- .env.deploy
volumes:
- .env.deploy:/app/.env
# 소스 코드 마운트
- ./apps/backend:/app/apps/backend
- ./apps/frontend:/app/apps/frontend
# 의존성 캐시를 위한 볼륨
- backend_node_modules:/app/node_modules
- backend_app_node_modules:/app/apps/backend/node_modules
- frontend_app_node_modules:/app/apps/frontend/node_modules
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- net
expose:
- "5173"
- "3000"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: always
websocket:
build:
context: .
dockerfile: ./services/websocket/Dockerfile.local
image: websocket:latest
env_file:
- .env.deploy
volumes:
- .env.deploy:/app/.env
# 소스 코드 마운트
- ./apps/websocket:/app/apps/websocket
# 의존성 캐시를 위한 볼륨
- websocket_node_modules:/app/node_modules
- websocket_app_node_modules:/app/apps/websocket/node_modules
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- net
expose:
- "4242"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:4242/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: always
nginx:
build:
context: .
dockerfile: ./services/nginx/Dockerfile.local
ports:
- "80:80"
- "443:443"
depends_on:
backend:
condition: service_healthy
websocket:
condition: service_healthy
networks:
- net
volumes:
# Let's Encrypt 인증서 마운트
- ./data/certbot/conf:/etc/letsencrypt:ro
- ./data/certbot/www:/var/www/certbot:ro
# 프로덕션 nginx 설정 사용
- ./services/nginx/conf.d/default.deploy.conf:/etc/nginx/conf.d/default.conf:ro
restart: always
# SSL 인증서 자동 갱신
certbot-renewer:
image: certbot/certbot:latest
volumes:
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot
- ./data/certbot/log:/var/log/letsencrypt
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew --webroot --webroot-path=/var/www/certbot; sleep 12h & wait $${!}; done;'"
restart: always
networks:
net:
volumes:
postgres_data:
backend_node_modules:
backend_app_node_modules:
frontend_app_node_modules:
websocket_node_modules:
websocket_app_node_modules: