-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
73 lines (68 loc) · 2.18 KB
/
docker-compose.yml
File metadata and controls
73 lines (68 loc) · 2.18 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
services:
# =========================================
# 1. MySQL (로컬 DB)
# =========================================
afternote-db:
image: mysql:8.0
container_name: afternote-db
platform: linux/amd64 # 맥북 호환성
restart: always
environment:
MYSQL_DATABASE: afternote
MYSQL_ROOT_PASSWORD: root
MYSQL_USER: admin
MYSQL_PASSWORD: password
TZ: Asia/Seoul
ports:
- "3306:3306"
volumes:
- ./db_data:/var/lib/mysql # 데이터 저장소
command: # 한글 깨짐 방지 설정
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 5s
timeout: 5s
retries: 10
# =========================================
# 2. Redis (캐시/세션)
# =========================================
afternote-redis:
image: redis:alpine
container_name: afternote-redis
ports:
- "6379:6379"
# =========================================
# 3. Spring Boot (내 서버)
# =========================================
afternote-server:
build: . # 현재 폴더의 Dockerfile을 보고 직접 빌드해라!
container_name: afternote-server
depends_on:
afternote-db:
condition: service_healthy # ⭐ [추가 2] DB가 '건강함' 상태가 될 때까지 대기
afternote-redis:
condition: service_started
environment:
# ⭐ 여기서 'dev'로 설정해야 테이블이 자동 생성됩니다!
SPRING_PROFILES_ACTIVE: dev
TZ: Asia/Seoul
# 도커 내부 통신용 주소 (localhost 대신 서비스명 사용)
env_file:
- .env
afternote-nginx:
image: nginx:alpine
container_name: afternote-nginx
ports:
- "80:80" # 외부(80) -> Nginx(80) -> Spring(8080)
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf # 로컬 개발용 설정
depends_on:
- afternote-server # 서버가 켜져야 Nginx도 의미가 있음
afternote-certbot:
image: certbot/certbot
container_name: afternote-certbot
volumes:
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot