Spaces:
Sleeping
Sleeping
| # Gunakan image Python yang ringan | |
| FROM python:3.9-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy file requirements dan install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # --- BAGIAN INI YANG HILANG DI FILE KAMU --- | |
| # 1. Copy seluruh file project (termasuk main.py) ke dalam container | |
| COPY . . | |
| # 2. Buat user baru (non-root) agar sesuai security policy Hugging Face | |
| # Ini Wajib agar tidak kena error "Permission Denied" | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # 3. Expose port 7860 (Port wajib untuk HF Spaces) | |
| EXPOSE 7860 | |
| # 4. Perintah utama untuk menyalakan server saat Space dijalankan | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |