# Gunakan image Python resmi FROM python:3.9-slim@sha256:bef8d69306a7905f55cd523f5604de1dde45bbf745ba896dbb89f6d15c727170 # Set working directory WORKDIR /app # Buat direktori cache dan atur izin RUN mkdir -p /app/cache && chmod -R 777 /app/cache # Bersihkan cache lama (untuk mencegah error izin) RUN rm -rf /app/cache/* && chmod -R 777 /app/cache # Upgrade pip untuk kompatibilitas paket terbaru RUN pip install --upgrade pip # Salin requirements.txt dan install dependensi COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Salin kode aplikasi COPY app.py . # Atur environment variable untuk cache ENV HF_HOME=/app/cache ENV TRANSFORMERS_CACHE=/app/cache # Pastikan izin direktori cache tetap benar sebelum menjalankan aplikasi RUN chmod -R 777 /app/cache # Jalankan aplikasi dengan uvicorn CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]