Mascode01 commited on
Commit
ed08f45
·
verified ·
1 Parent(s): 59efb01

Upload 2 files

Browse files
Files changed (2) hide show
  1. .dockerignore +5 -0
  2. Dockerfile +39 -0
.dockerignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ __pycache__
2
+ *.pyc
3
+ .git
4
+ .gitignore
5
+ .env
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Gunakan image Python resmi yang ringan
2
+ FROM python:3.10-slim
3
+
4
+ # Set working directory di dalam container
5
+ WORKDIR /app
6
+
7
+ # Install dependencies sistem yang mungkin dibutuhkan
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
+ build-essential \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Salin file requirements.txt ke dalam container
13
+ COPY requirements.txt .
14
+
15
+ # Install dependencies dari requirements.txt
16
+ RUN pip install --no-cache-dir -r requirements.txt
17
+
18
+ # Install PyTorch dan Transformers jika belum ada di requirements.txt (karena dibutuhkan oleh model)
19
+ # Menggunakan versi CPU-only untuk menghemat ukuran image jika dijalankan di Spaces gratis (opsional)
20
+ # RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
21
+ RUN pip install --no-cache-dir torch transformers accelerate indobenchmark-toolkit
22
+
23
+ # Salin seluruh file project ke dalam container
24
+ COPY . .
25
+
26
+ # Berikan akses write ke user non-root (syarat Hugging Face Spaces)
27
+ RUN useradd -m -u 1000 user
28
+ USER user
29
+ ENV HOME=/home/user \
30
+ PATH=/home/user/.local/bin:$PATH
31
+
32
+ WORKDIR $HOME/app
33
+ COPY --chown=user . $HOME/app
34
+
35
+ # Expose port yang digunakan oleh Hugging Face Spaces
36
+ EXPOSE 7860
37
+
38
+ # Perintah untuk menjalankan aplikasi
39
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]