-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
115 lines (110 loc) · 3.23 KB
/
docker-compose.yml
File metadata and controls
115 lines (110 loc) · 3.23 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
# ========================================
# Finders API - 로컬 개발 환경 (기본 파일)
# ========================================
# 사용법:
# 1. MySQL만 실행 (Spring은 IDE에서):
# docker compose up -d
# ./gradlew bootRun
#
# 2. 전체 실행 (MySQL + Spring):
# docker compose --profile full up -d
#
# 3. 종료:
# docker compose down
#
# 4. 데이터 초기화:
# docker compose down -v
#
# Note:
# 서버 배포용 파일은 docker-compose.infra.yml 을 참고하세요.
# ========================================
services:
# ========================================
# MySQL Database (로컬 개발용)
# ========================================
mysql:
image: mysql:8.0
container_name: finders-mysql
restart: unless-stopped
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: finders
MYSQL_USER: finders
MYSQL_PASSWORD: finders123
TZ: Asia/Seoul
volumes:
- mysql-data:/var/lib/mysql
- ./docker/mysql/init:/docker-entrypoint-initdb.d
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --skip-character-set-client-handshake
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-proot"]
interval: 10s
timeout: 5s
retries: 5
networks:
- finders-network
# ========================================
# Redis (캐싱 및 세션 관리)
# ========================================
redis:
image: redis:8.0-alpine
container_name: finders-redis
restart: unless-stopped
ports:
- "6379:6379"
command: redis-server --save 60 1 --loglevel warning --maxmemory 128mb --maxmemory-policy allkeys-lru
volumes:
- redis-data:/data
deploy:
resources:
limits:
memory: 256m
networks:
- finders-network
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
timeout: 5s
retries: 5
# ========================================
# Spring Boot Backend (로컬 전체 실행용)
# ========================================
backend:
build:
context: .
dockerfile: Dockerfile
container_name: finders-api
restart: unless-stopped
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
ports:
- "8080:8080"
environment:
SPRING_PROFILES_ACTIVE: local
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/finders?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul
SPRING_DATASOURCE_USERNAME: finders
SPRING_DATASOURCE_PASSWORD: finders123
SPRING_DATA_REDIS_HOST: redis
SPRING_DATA_REDIS_PORT: 6379
JWT_SECRET: ${JWT_SECRET:-local-dev-secret-key-must-be-at-least-256-bits-long-for-hs256}
KAKAO_CLIENT_ID: ${KAKAO_CLIENT_ID:-}
KAKAO_CLIENT_SECRET: ${KAKAO_CLIENT_SECRET:-}
KAKAO_REDIRECT_URI: ${KAKAO_REDIRECT_URI:-http://localhost:8080/api/auth/kakao/callback}
GCS_BUCKET: ${GCS_BUCKET:-}
networks:
- finders-network
profiles:
- full # docker compose --profile full up 으로 실행
volumes:
mysql-data:
redis-data:
networks:
finders-network: