MACSWAI commited on
Commit
2f15e95
·
verified ·
1 Parent(s): 01f5153

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -11
Dockerfile CHANGED
@@ -1,17 +1,33 @@
1
- # Gunakan Python versi 3.9
2
- FROM python:3.9
3
 
4
- # Set working directory
5
- WORKDIR /code
 
 
 
6
 
7
- # Copy semua file dari root (termasuk app.py dan requirements.txt) ke dalam container
8
- COPY . .
 
 
 
 
9
 
10
- # Install library
 
 
 
 
 
 
11
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
12
 
13
- # Berikan izin ke file (penting di HF)
14
- RUN chmod -R 777 /code
 
 
 
15
 
16
- # Jalankan Streamlit di port 7860 (Port wajib Hugging Face)
17
- CMD ["streamlit", "run", "app.py", "--server.address", "0.0.0.0", "--server.port", "7860"]
 
1
+ # Gunakan Python 3.9
2
+ FROM python:3.9-slim
3
 
4
+ # 1. Install FFmpeg (Wajib untuk video downloader) & git
5
+ RUN apt-get update && apt-get install -y \
6
+ ffmpeg \
7
+ git \
8
+ && rm -rf /var/lib/apt/lists/*
9
 
10
+ # 2. Setup User Khusus (PENTING untuk Hugging Face)
11
+ # Hugging Face menyarankan menggunakan user ID 1000 agar tidak ada masalah permission
12
+ RUN useradd -m -u 1000 user
13
+ USER user
14
+ ENV HOME=/home/user \
15
+ PATH=/home/user/.local/bin:$PATH
16
 
17
+ # 3. Set Working Directory
18
+ WORKDIR $HOME/app
19
+
20
+ # 4. Copy file dengan izin user yang benar
21
+ COPY --chown=user . $HOME/app
22
+
23
+ # 5. Install dependencies
24
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
25
 
26
+ # 6. Konfigurasi agar Streamlit tidak macet (Disable Email & Stats)
27
+ ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
28
+ ENV STREAMLIT_SERVER_HEADLESS=true
29
+ ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
30
+ ENV STREAMLIT_SERVER_PORT=7860
31
 
32
+ # 7. Jalankan Aplikasi
33
+ CMD ["streamlit", "run", "app.py"]