-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
118 lines (113 loc) · 4.22 KB
/
docker-compose.yml
File metadata and controls
118 lines (113 loc) · 4.22 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
116
117
118
services:
# 라이브러리 초기화 서비스 (한 번만 실행)
python-libs-init:
build:
context: ./fastapi
dockerfile: src/Dockerfile.libs
container_name: python-libs-init
volumes:
- python-libs:/opt/python-libs
command: >
sh -c "
if [ ! -f /opt/python-libs/.initialized ]; then
echo 'Installing Python libraries...'
pip install --target=/opt/python-libs/lib/python3.11/site-packages 'numpy>=1.22.4,<2.0.0'
pip install --target=/opt/python-libs/lib/python3.11/site-packages torch==2.3.1+cu121 torchvision==0.18.1+cu121 torchaudio==2.3.1+cu121 -f https://download.pytorch.org/whl/torch_stable.html
pip install --target=/opt/python-libs/lib/python3.11/site-packages -r requirements.txt
CMAKE_ARGS='-DGGML_CUDA=ON' pip install --target=/opt/python-libs/lib/python3.11/site-packages llama-cpp-python --no-cache-dir --force-reinstall
pip install --target=/opt/python-libs/lib/python3.11/site-packages https://github.com/oobabooga/llama-cpp-python-cuBLAS-wheels/releases/download/textgen-webui/llama_cpp_python_cuda-0.2.62+cu121-cp311-cp311-manylinux_2_31_x86_64.whl
pip install --target=/opt/python-libs/lib/python3.11/site-packages exllamav2 pynvml uvicorn
touch /opt/python-libs/.initialized
echo 'Libraries installation completed!'
else
echo 'Libraries already installed, skipping...'
fi
"
office:
build:
context: ./fastapi
dockerfile: src/server/office/Dockerfile
container_name: office
ports:
- "8002:8002"
volumes:
- python-libs:/opt/python-libs:ro
- ${PWD}/fastapi/ai_model/QuantFactory:/app/fastapi/ai_model/QuantFactory:rw
- ${PWD}/fastapi/logs:/app/logs:rw
- ${PWD}/fastapi/src/.env:/app/.env:ro
- ${PWD}/fastapi/src/bot.yaml:/bot.yaml:ro
depends_on:
- python-libs-init
deploy:
resources:
limits:
memory: 8G # 메모리 제한 추가
cpus: '4.0' # CPU 제한 추가
reservations:
memory: 4G # 최소 메모리 보장
devices:
- driver: nvidia
device_ids: [GPU-4c150f7a-f33e-829b-fed0-21c080a21e96]
capabilities: [gpu]
environment:
- TZ=Asia/Seoul
- NVIDIA_VISIBLE_DEVICES=1
- CUDA_VISIBLE_DEVICES=1
- PYTHONPATH=/opt/python-libs/lib/python3.11/site-packages:/app:/app/src
- PYTHONUNBUFFERED=1
- PYTHONDONTWRITEBYTECODE=1
- OPENAI_API_KEY=${OPENAI_API_KEY}
- MONGO_URL=${MONGO_URL:-mongodb://root:1234@192.168.3.145:27017/chatbot?authSource=admin}
- UVICORN_HTTP=h11 # HTTP/1.1 강제
- APP_MODE=office
character:
build:
context: ./fastapi
dockerfile: src/server/character/Dockerfile
container_name: character
ports:
- "8003:8003"
volumes:
- python-libs:/opt/python-libs:ro
- ${PWD}/fastapi/ai_model/QuantFactory:/app/fastapi/ai_model/QuantFactory:rw
- ${PWD}/fastapi/logs:/app/logs:rw
- ${PWD}/fastapi/src/.env:/app/.env:ro
- ${PWD}/fastapi/src/bot.yaml:/bot.yaml:ro
depends_on:
- python-libs-init
deploy:
resources:
limits:
memory: 8G # 메모리 제한 추가
cpus: '4.0' # CPU 제한 추가
reservations:
memory: 4G # 최소 메모리 보장
devices:
- driver: nvidia
device_ids: [GPU-eeda57d0-cf83-ba04-0355-41d7d20ffd54]
capabilities: [gpu]
environment:
- TZ=Asia/Seoul
- NVIDIA_VISIBLE_DEVICES=0
- CUDA_VISIBLE_DEVICES=0
- PYTHONPATH=/opt/python-libs/lib/python3.11/site-packages:/app:/app/src
- PYTHONUNBUFFERED=1
- PYTHONDONTWRITEBYTECODE=1
- OPENAI_API_KEY=${OPENAI_API_KEY}
- MONGO_URL=${MONGO_URL:-mongodb://root:1234@192.168.3.145:27017/chatbot?authSource=admin}
- UVICORN_HTTP=h11 # HTTP/1.1 강제
- APP_MODE=character
nginx:
image: nginx:latest
container_name: nginx
ports:
- "8001:8001"
volumes:
- ${PWD}/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ${PWD}/nginx/404.html:/etc/nginx/html/404.html:ro
depends_on:
- office
- character
volumes:
python-libs:
driver: local