forked from DCUSnSLab/DCU_Online_Judge_Deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
79 lines (76 loc) · 2.87 KB
/
docker-compose.yml
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"
services:
oj-redis:
image: redis:4.0-alpine
container_name: oj-redis
restart: always
volumes:
- ./data/redis:/data
oj-postgres:
image: postgres:10-alpine
container_name: oj-postgres
restart: always
volumes:
- ./data/postgres:/var/lib/postgresql/data
environment: # 데이터베이스 생성 및 초기화를 위한 환경 변수
- POSTGRES_DB=onlinejudge
- POSTGRES_USER=onlinejudge
- POSTGRES_PASSWORD=onlinejudge
judge-server:
image: snslabdocker/judge_server:latest
container_name: judge-server
restart: always
# judge-server의 경우 아래 read_only, cap_drop 과 같이 내부에서 수행할 수 있는 작업이 제한됨
read_only: true
cap_drop:
- SETPCAP
- MKNOD
- NET_BIND_SERVICE
- SYS_CHROOT
- SETFCAP
- FSETID
tmpfs:
- /tmp
volumes:
- ./data/backend/test_case:/test_case:ro
- ./data/judge_server/log:/log
- ./data/judge_server/run:/judger
environment:
- SERVICE_URL=http://judge-server:8080
- BACKEND_URL=http://oj-backend:8000/api/judge_server_heartbeat/
- TOKEN=CHANGE_THIS
- judger_debug=1
oj-backend: # backend 컨테이너의 경우 이미지 entrypoint의 스크립트로 Django 서버 시작
image: snslabdocker/dcu_code_be:0.4
container_name: oj-backend
restart: always
depends_on: # 아래 3개의 컨테이너가 시작한 뒤 backend 컨테이너 실행 시작
- oj-redis
- oj-postgres
- judge-server
volumes: # HOST 장치에 data/backend 디렉토리 생성 후 컨테이너 내의 /data 디렉토리와 동기화한다.
- ./data/backend:/data
environment: # 최초 배포 시 사용되는 환경 변수 값
- OJ_ENV=production
- POSTGRES_DB=onlinejudge
- POSTGRES_USER=onlinejudge
- POSTGRES_PASSWORD=onlinejudge
- JUDGE_SERVER_TOKEN=CHANGE_THIS
# HTTPS 및 CDN 호스트 관련 옵션
# - FORCE_HTTPS=1
# - STATIC_CDN_HOST=cdn.oj.com
oj-frontend: # frontend의 경우 command parameter를 통해 node 웹 서버 실행 진행
image: snslabdocker/dcu_code_fe:0.9
container_name: oj-frontend
restart: always
#command: /bin/bash -c "while true; do echo test; sleep 100; done"
command: /bin/bash start_node.sh
depends_on:
- oj-backend
volumes: # backend와 마찬가지로 컨테이너 - HOST 간 특정 디렉토리를 공유한다.
- ./data/frontend:/data
environment:
- TARGET=http://oj-backend:8000
ports:
- "0.0.0.0:80:80"
- "0.0.0.0:443:1443"