# Gunakan image Python yang ringan tapi tetap stabil FROM python:3.10-slim # Set working directory di dalam container WORKDIR /app # Set environment variable untuk cache model ENV TRANSFORMERS_CACHE=/tmp/huggingface ENV HF_HOME=/tmp/huggingface ENV PYTHONUNBUFFERED=1 # Install dependencies dasar RUN apt-get update && apt-get install -y \ git \ && rm -rf /var/lib/apt/lists/* # Salin semua file ke dalam container COPY . . # Install dependency Python RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir fastapi uvicorn transformers torch huggingface_hub pydantic # Expose port untuk Hugging Face Spaces (harus 7860) EXPOSE 7860 # Jalankan aplikasi FastAPI CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]