-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
123 lines (118 loc) · 3.84 KB
/
Copy pathdocker-compose.yml
File metadata and controls
123 lines (118 loc) · 3.84 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
# 인프라(MySQL + Redis + MinIO) + 백엔드(Spring Boot) + 프론트(React, nginx) 를 한 번에 띄운다.
#
# 사용법: back-end/.env 를 준비한 뒤(.env.example 참고, JWT_SECRET 필수),
# docker compose up -d --build # 전체 기동 (최초 실행/코드 변경 후에는 --build 필요)
# docker compose ps # 상태 확인
# docker compose logs -f backend # 백엔드 로그 확인
# docker compose down # 중지 (데이터는 볼륨에 보존)
# docker compose down -v # 중지 + 데이터 볼륨 삭제(초기화)
#
# 인프라만 띄우고 앱은 IDE/로컬에서 실행하고 싶다면:
# docker compose up -d mysql redis minio
services:
mysql:
image: mysql:8.4
container_name: youthpick-mysql
environment:
MYSQL_DATABASE: ${DB_NAME:-youthpick}
MYSQL_USER: ${DB_USERNAME:-youthpick}
MYSQL_PASSWORD: ${DB_PASSWORD:-youthpick}
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-root}
TZ: Asia/Seoul
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
ports:
- "${DB_PORT:-3306}:3306"
volumes:
- youthpick-mysql-data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-p${DB_ROOT_PASSWORD:-root}"]
interval: 10s
timeout: 5s
retries: 10
start_period: 20s
redis:
image: redis:7-alpine
container_name: youthpick-redis
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- youthpick-redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 10
minio:
image: quay.io/minio/minio:RELEASE.2025-09-07T16-13-09Z
container_name: youthpick-minio
environment:
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:-minioadmin}
command: server /data --console-address ":9001"
ports:
- "${MINIO_API_PORT:-9000}:9000"
- "${MINIO_CONSOLE_PORT:-9001}:9001"
volumes:
- youthpick-minio-data:/data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
elasticsearch:
build: ./es
container_name: youthpick-es
environment:
- discovery.type=single-node # 단일 노드 (클러스터 구성 안 함)
- xpack.security.enabled=false # 로컬이라 인증 끔
- ES_JAVA_OPTS=-Xms512m -Xmx512m # 안 주면 시스템 메모리의 절반을 먹는다
ports:
- "${ES_PORT:-9200}:9200"
volumes:
- youthpick-es-data:/usr/share/elasticsearch/data
- ./es/config:/usr/share/elasticsearch/config/analysis
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:9200/_cluster/health || exit 1"]
interval: 10s
timeout: 5s
retries: 12
start_period: 40s
backend:
build:
context: .
dockerfile: Dockerfile
container_name: youthpick-backend
depends_on:
mysql:
condition: service_healthy
redis:
condition: service_healthy
minio:
condition: service_healthy
env_file:
- .env
environment:
# 컨테이너 네트워크 안에서는 localhost 가 아니라 서비스명으로 붙는다 (.env 의 localhost 값을 덮어씀).
DB_URL: jdbc:mysql://mysql:3306/${DB_NAME:-youthpick}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Seoul
REDIS_HOST: redis
REDIS_PORT: 6379
MINIO_ENDPOINT: http://minio:9000
ports:
- "8080:8080"
frontend:
build:
context: ../front-end
dockerfile: Dockerfile
container_name: youthpick-frontend
depends_on:
- backend
ports:
- "5173:80"
volumes:
youthpick-mysql-data:
youthpick-redis-data:
youthpick-minio-data:
youthpick-es-data: