FROM python:3.11-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # app.py + ชุดข้อมูลตัวอย่างจริงของ ENT (ใช้โดย GET /api/sample) COPY app.py sample_ent.json ./ EXPOSE 7860 # -w 2 : 2 worker — cache ผล backtest แยกกันคนละ worker (ยอมรับได้ เพราะ backtest ~1–3 วิ) # -t 180 : rolling-origin backtest บน CPU ฟรีของ HF อาจใช้เวลาถึง ~30 วิ ในกรณีข้อมูลยาว CMD ["gunicorn", "-b", "0.0.0.0:7860", "-w", "2", "-t", "180", "app:app"]