-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
79 lines (74 loc) · 2.42 KB
/
docker-compose.yml
File metadata and controls
79 lines (74 loc) · 2.42 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
version: '3.9'
services:
redis:
container_name: redis-container
image: redis:latest
ports:
- "6379:6379"
networks:
- app-network
volumes:
- ./redis/data:/data # Redis 데이터 저장
- ./redis.conf:/usr/local/etc/redis/redis.conf # 설정 파일 마운트
env_file:
- .env # 환경변수를 .env 파일에서 읽어옴
command: [ "redis-server", "--requirepass", "${REDIS_PASSWORD}", "--appendonly", "yes" ] # 비밀번호 및 AOF 설정
privileged: true
rabbitmq:
container_name: rabbitmq-container
image: rabbitmq:3-management-alpine
ports:
- "5672:5672" # AMQP 프로토콜 포트 (백엔드에서 사용)
- "15672:15672" # 관리 UI 포트 (웹에서 확인 가능)
- "61613:61613" # STOMP 포트 추가
networks:
- app-network
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD}
volumes:
- ./rabbitmq/data:/var/lib/rabbitmq # 데이터 저장
- ./rabbitmq/log:/var/log/rabbitmq # 로그 저장
- ./rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf # 설정 파일 마운트
env_file:
- .env # 환경변수를 .env 파일에서 읽어옴
command: >
sh -c "rabbitmq-plugins enable rabbitmq_stomp rabbitmq_web_stomp &&
rabbitmq-server"
healthcheck:
test: [ "CMD", "rabbitmqctl", "status" ]
interval: 30s
timeout: 10s
retries: 3
backend:
container_name: spring-app
image: ${DOCKER_USERNAME}/${DOCKER_REPO}:latest
env_file:
- .env # 환경변수를 .env 파일에서 읽어옴
ports:
- "8080:8080" # 호스트 8080 -> 컨테이너 8080
networks:
- app-network
depends_on:
- redis
- rabbitmq # RabbitMQ 의존성 추가
nginx:
container_name: nginx-container
image: nginx:latest
ports:
- "80:80" # HTTP 요청 처리
- "443:443" # HTTPS 요청 처리
networks:
- app-network
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro # nginx.conf 파일
depends_on:
- backend
networks:
app-network:
driver: bridge
# Docker 네트워크에 연결되지 않았다면 추가
# sudo docker network connect app-network nginx-container
# sudo docker network connect app-network spring-app
# sudo docker network connect app-network redis-container
# sudo docker network connect app-network rabbitmq-container