| FROM python:3.11-slim | |
| # Fix encoding untuk pip install dan runtime | |
| ENV PYTHONUTF8=1 LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONIOENCODING=utf-8 PIP_PROGRESS_BAR=off | |
| WORKDIR /app | |
| # System dependencies untuk OpenCV | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Upgrade pip dulu untuk hindari bug encoding | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy seluruh aplikasi | |
| COPY . . | |
| # Hugging Face Spaces menggunakan port 7860 | |
| EXPOSE 7860 | |
| # Jalankan FastAPI dengan wrapper (force UTF-8) | |
| CMD ["python", "run.py"] | |