File size: 875 Bytes
f537fa7
 
15585fd
f537fa7
 
 
 
 
15585fd
f537fa7
 
e706de2
 
 
15585fd
 
e706de2
15585fd
 
 
e706de2
15585fd
 
e706de2
15585fd
e706de2
 
15585fd
 
 
 
 
f537fa7
 
e706de2
 
 
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
FROM node:18

# Cài đặt system dependencies
RUN apt-get update && apt-get install -y \
    python3 \
    make \
    g++ \
    cmake \
    wget \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Copy package files
COPY package*.json ./

# Cài đặt npm dependencies
# --unsafe-perm để đảm bảo script postinstall (như node-llama-cpp download) chạy được dưới quyền root
RUN npm install --unsafe-perm

# Copy code
COPY . .

# Tạo thư mục models
RUN mkdir -p models

# Tải model thủ công bằng wget thay vì npx (ổn định hơn trong docker)
# URL trực tiếp từ Hugging Face
RUN wget -O models/Qwen3-1.7B-Q8_0.gguf https://huggingface.co/Qwen/Qwen3-1.7B-GGUF/resolve/main/Qwen3-1.7B-Q8_0.gguf?download=true

# Force rebuild node-llama-cpp
RUN npm rebuild node-llama-cpp

EXPOSE 7860

CMD ["node", "server.js"]