File size: 767 Bytes
63afcca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Gunakan image Python yang ringan
FROM python:3.9-slim

# Set working directory
WORKDIR /app

# Copy file requirements dan install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# --- BAGIAN INI YANG HILANG DI FILE KAMU ---

# 1. Copy seluruh file project (termasuk main.py) ke dalam container
COPY . .

# 2. Buat user baru (non-root) agar sesuai security policy Hugging Face
# Ini Wajib agar tidak kena error "Permission Denied"
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# 3. Expose port 7860 (Port wajib untuk HF Spaces)
EXPOSE 7860

# 4. Perintah utama untuk menyalakan server saat Space dijalankan
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]