File size: 678 Bytes
17ad64d
994a613
17ad64d
994a613
17ad64d
 
 
 
994a613
17ad64d
 
 
994a613
17ad64d
 
 
 
 
 
994a613
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
FROM python:3.10-slim

WORKDIR /app

# Cài dependencies trước để tận dụng Docker layer cache
COPY requirements.txt .
RUN pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu torch==2.3.1 \
    && pip install --no-cache-dir -r requirements.txt

# Copy code + meta-classifier đã train sẵn
COPY app.py .
COPY meta_classifier.joblib .

# HF Space mặc định expose port 7860
EXPOSE 7860

# Cache HF models trong container (tránh lỗi permission khi Space chạy non-root)
ENV HF_HOME=/app/.cache/huggingface
RUN mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]