File size: 742 Bytes
02f8a29
 
 
 
 
 
2d48165
 
 
19dec0c
 
 
02f8a29
 
 
 
 
 
 
2d48165
 
 
 
19dec0c
 
 
02f8a29
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Gunakan image Python resmi
FROM python:3.9-slim

# 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

# 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"]