FROM python:3.10-slim ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends git ffmpeg && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip install --upgrade pip RUN pip install --no-cache-dir -r requirements.txt COPY . . # TẢI SẴN MODEL NGAY KHI BUILD IMAGE (chỉ chạy 1 lần duy nhất) RUN python -c "\ from transformers import AutoTokenizer, AutoModelForSequenceClassification; \ print('Đang tải model 5CD-AI/Vietnamese-Sentiment-visobert...'); \ AutoTokenizer.from_pretrained('5CD-AI/Vietnamese-Sentiment-visobert'); \ AutoModelForSequenceClassification.from_pretrained('5CD-AI/Vietnamese-Sentiment-visobert'); \ print('Tải model xong!')" EXPOSE 7860 CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app", "--workers", "1", "--threads", "4", "--timeout", "180"]