| FROM python:3.11-slim | |
| # Install dependensi sistem untuk yt-dlp | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ffmpeg \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Buat user non-root (persyaratan HuggingFace Spaces) | |
| RUN useradd -m -u 1000 appuser | |
| WORKDIR /app | |
| # Salin dan install dependensi Python | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Salin kode aplikasi | |
| COPY . . | |
| # Ganti ke user non-root | |
| USER appuser | |
| # HuggingFace Spaces menggunakan port 7860 | |
| EXPOSE 7860 | |
| # Jalankan dengan gunicorn untuk production | |
| CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "300", "app:app"] | |