forked from EWHA-LIKELION/13th-Session-Back
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
45 lines (43 loc) · 1.6 KB
/
docker-compose.prod.yml
File metadata and controls
45 lines (43 loc) · 1.6 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
version: '3'
services:
# Django 웹 애플리케이션을 실행
web:
container_name: web
build:
context: ./
dockerfile: Dockerfile.prod # Dockerfile.prod를 사용해 이미지를 빌드
# 컨테이너가 시작될 때 Gunicorn 웹 서버를 사용하여 Django 애플리케이션을 실행
command: gunicorn drfproject.wsgi:application --bind 0.0.0.0:8000
environment: # settings.prod를 설정 모듈로 설정
DJANGO_SETTINGS_MODULE: drfproject.settings.prod
env_file:
- .env # 환경 변수를 .env 파일에서 로드
volumes:
- static:/home/app/web/static
- media:/home/app/web/media
expose:
- 8000
# 컨테이너가 시작될 때 entrypoint.prod.sh 스크립트를 실행하여 초기화 작업을 수행
entrypoint:
- sh
- config/docker/entrypoint.prod.sh
# Nginx를 사용하여 웹 서버를 설정, Django 애플리케이션에 대한 요청을 처리
nginx:
container_name: nginx
# ./config/nginx의 Dockerfile을 사용해 Nginx 이미지를 빌드
build: ./config/nginx
volumes:
- static:/home/app/web/static # Nginx가 정적 파일을 제공할 수 있도록 설정
- media:/home/app/web/media # 미디어 파일을 제공할 수 있도록 설정
ports:
- "80:80"
# 호스트의 80 포트를 컨테이너의 80 포트에 매핑하여
# Nginx가 HTTP 요청을 수신할 수 있도록 함
depends_on:
- web
environment:
TZ: "Asia/Seoul"
# 정적 파일과 미디어 파일을 저장할 볼륨을 정의
volumes:
static:
media: