This repository was archived by the owner on Oct 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
115 lines (106 loc) · 3.31 KB
/
docker-compose.yml
File metadata and controls
115 lines (106 loc) · 3.31 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
version: '3.8' # Docker Compose의 버전을 지정합니다.
services: # 서비스 목록을 정의합니다.
django: # Django 애플리케이션 서비스를 정의합니다.
build: # 이미지 빌드 정보를 지정합니다.
context: . # 빌드 컨텍스트로 현재 디렉토리를 사용합니다.
# dockerfile: Dockerfile # 사용할 Dockerfile을 지정합니다.
args:
SERVICE_TYPE: django
ports:
- "8000:8000" # 호스트의 8000 포트와 컨테이너의 8000 포트를 연결합니다.
environment: # 환경 변수를 설정합니다.
DJANGO_SETTINGS_MODULE: core.settings
DB_NAME: ${DB_NAME}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
depends_on:
- db # db 서비스가 시작된 후에 django 서비스를 시작합니다.
volumes:
# 현재 디렉토리를 컨테이너의 /app 디렉토리에 마운트합니다.
- .:/app
- ./core/logging:/app/core/logging
hostname: django
db:
image: postgres:15.4-alpine3.18
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- pgdata:/var/lib/postgresql/data
redis:
image: redis:latest
ports:
- "6379:6379"
daphne:
build:
context: .
# dockerfile: Dockerfile
# 추가
args:
SERVICE_TYPE: daphne
ports:
- "8001:8001"
environment:
DJANGO_SETTINGS_MODULE: core.settings
DB_NAME: ${DB_NAME}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
depends_on:
# - django
- db
- redis
volumes:
- .:/app
- ./staticfiles:/app/staticfiles
- daphne-socket:/tmp
hostname: daphne
# command: ["daphne", "-b", "0.0.0.0", "-p", "8001", "core.asgi:application"]
command: ["daphne", "-u", "/tmp/daphne1.sock", "core.asgi:application"]
# restart: unless-stopped # daphne 가 code 0 로 종료되는 것 대응. 즉, 에러 해결 촉구 트리거. 현재 꺼둠.
nginx:
build:
context: .
dockerfile: Dockerfile.nginx # custom Dockerfile for nginx
ports:
- "80:80" # 호스트의 80 포트와 컨테이너의 80 포트를 맵핑합니다.
- "443:443"
volumes:
# 호스트의 ./nginx/nginx.conf 파일을 컨테이너의 /etc/nginx/nginx.conf 위치에 읽기 전용으로 마운트합니다.
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- /etc/letsencrypt:/etc/letsencrypt
# 본 nginx 의 정적 파일 경로를 설정합니다.
- ./staticfiles:/staticfiles
- daphne-socket:/tmp
depends_on:
- django # django 서비스가 시작된 후에 nginx 서비스를 시작합니다.
- daphne
celery_worker:
build:
context: .
args:
SERVICE_TYPE: django
command: celery -A core worker --loglevel=info
volumes:
- .:/app
depends_on:
- db
- redis
celery_beat:
build:
context: .
args:
SERVICE_TYPE: django
command: celery -A core beat --loglevel=info
volumes:
- .:/app
depends_on:
- db
- redis
volumes: # 볼륨을 정의합니다.
pgdata: # pgdata 볼륨을 생성합니다.
daphne-socket: