File size: 767 Bytes
43149fe
2685f67
 
43149fe
2685f67
 
43149fe
 
 
 
2685f67
43149fe
 
 
 
21c0980
43149fe
 
 
 
 
 
 
 
2685f67
 
43149fe
2685f67
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
29
# 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"]