Translator / Dockerfile
feliksius's picture
Update Dockerfile
19dec0c verified
raw
history blame contribute delete
742 Bytes
# 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"]