-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
49 lines (45 loc) · 1.4 KB
/
docker-compose.yml
File metadata and controls
49 lines (45 loc) · 1.4 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
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:/etc/redis/redis.conf # 설정 파일 마운트
env_file:
- .env # 환경변수를 .env 파일에서 읽어옴
command: [ "redis-server", "--requirepass", "${REDIS_PASSWORD}", "--appendonly", "yes" ] # 비밀번호 및 AOF 설정
privileged: true
backend:
container_name: spring-app
image: ${DOCKER_USERNAME}/${DOCKER_REPO}:latest
env_file:
- .env # 환경변수를 .env 파일에서 읽어옴
ports:
- "8080:8080" # 호스트 8080 -> 컨테이너 8080
networks:
- app-network
nginx:
container_name: nginx-container
image: nginx:latest
ports:
- "80:80" # HTTP 요청 처리
- "443:443" # HTTPS 요청 처리
networks:
- app-network
volumes:
- /etc/letsencrypt:/etc/letsencrypt:ro # 인증서 파일
- ./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