Arabi32 commited on
Commit
bee5339
·
verified ·
1 Parent(s): 68e1e39

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -12
Dockerfile CHANGED
@@ -1,27 +1,35 @@
1
- FROM python:3.10-slim
2
 
3
- # تثبيت مكتبات النظام وأدوات البناء (ضرورية لـ XTTS)
4
- RUN apt-get update && apt-get install -y \
5
  ffmpeg \
6
  libsndfile1 \
 
7
  build-essential \
8
  python3-dev \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- # إعداد المستخدم (متطلبات Hugging Face)
12
  RUN useradd -m -u 1000 user
13
- USER user
14
- ENV PATH="/home/user/.local/bin:${PATH}"
15
 
 
16
  WORKDIR /app
17
 
18
- # نسخ الملفات وتغيير الملكية للمستخدم الجديد
19
- COPY --chown=user . .
 
 
 
 
20
 
21
- # تثبيت المكتبات
22
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
23
 
24
- # المنفذ الافتراضي لـ HF هو 7860
25
  EXPOSE 7860
26
 
27
- CMD ["python", "app.py"]
 
 
1
+ FROM python:3.9-slim
2
 
3
+ # Install system dependencies
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
  ffmpeg \
6
  libsndfile1 \
7
+ git \
8
  build-essential \
9
  python3-dev \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Create non-root user
13
  RUN useradd -m -u 1000 user
 
 
14
 
15
+ # Set working directory
16
  WORKDIR /app
17
 
18
+ # Copy requirements first (for better caching)
19
+ COPY --chown=user:user requirements.txt ./
20
+
21
+ # Install Python dependencies
22
+ RUN pip install --no-cache-dir --upgrade pip && \
23
+ pip install --no-cache-dir -r requirements.txt
24
 
25
+ # Copy the rest of the app
26
+ COPY --chown=user:user . .
27
+
28
+ # Switch to non-root user
29
+ USER user
30
 
31
+ # Expose port (for Gradio/Streamlit)
32
  EXPOSE 7860
33
 
34
+ # Run command
35
+ CMD ["python", "app.py"]