| # Base image Python 3.10 slim | |
| FROM python:3.10-slim | |
| # ------------------------- | |
| # 1. Cài thư viện hệ thống | |
| # ------------------------- | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| git-lfs \ | |
| ffmpeg \ | |
| libsm6 \ | |
| libxext6 \ | |
| libgl1 \ | |
| cmake \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && git lfs install | |
| # ------------------------- | |
| # 2. Thiết lập working directory | |
| # ------------------------- | |
| WORKDIR /app | |
| # ------------------------- | |
| # 3. Copy requirements.txt vào | |
| # ------------------------- | |
| COPY requirements.txt . | |
| # ------------------------- | |
| # 4. Upgrade pip và cài Python packages | |
| # ------------------------- | |
| RUN pip install --no-cache-dir --upgrade pip | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # ------------------------- | |
| # 5. Copy toàn bộ source code | |
| # ------------------------- | |
| COPY . . | |
| # ------------------------- | |
| # 6. Expose port mặc định HF Space | |
| # ------------------------- | |
| EXPOSE 7860 | |
| # ------------------------- | |
| # 7. Chạy Flask app | |
| # ------------------------- | |
| # HF Spaces yêu cầu chạy trên 0.0.0.0 và port $PORT | |
| CMD ["python", "app.py"] | |