Muhammadidrees commited on
Commit
a5f5a80
·
verified ·
1 Parent(s): 4e3ebe9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +51 -46
Dockerfile CHANGED
@@ -1,59 +1,64 @@
1
- # ----------------------------
2
- # Base image: Python 3.11
3
- # ----------------------------
4
  FROM python:3.11-slim
5
 
6
- # ----------------------------
7
- # Set working directory
8
- # ----------------------------
9
- WORKDIR /home/user/app
 
10
 
11
- # ----------------------------
12
- # System dependencies
13
- # ----------------------------
14
- RUN apt-get update && apt-get install -y \
15
- git \
16
- git-lfs \
17
- ffmpeg \
18
- libsm6 \
19
- libxext6 \
20
- cmake \
21
- rsync \
22
- libgl1 \
23
- curl \
 
 
24
  && rm -rf /var/lib/apt/lists/* \
25
  && git lfs install
26
 
27
- # ----------------------------
28
- # Node.js (if needed for Gradio frontend)
29
- # ----------------------------
30
- RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
31
- && apt-get install -y nodejs \
32
- && rm -rf /var/lib/apt/lists/* \
33
- && apt-get clean
34
-
35
- # ----------------------------
36
- # Upgrade pip
37
- # ----------------------------
38
- RUN pip install --no-cache-dir --upgrade pip
39
 
40
- # ----------------------------
41
- # Install Python dependencies
42
- # ----------------------------
43
  COPY requirements.txt /tmp/requirements.txt
44
- RUN pip install --no-cache-dir -r /tmp/requirements.txt
 
 
 
 
 
 
 
45
 
46
- # ----------------------------
47
- # Copy app code
48
- # ----------------------------
49
- COPY --chown=1000:1000 . /home/user/app
 
50
 
51
- # ----------------------------
52
- # Expose port (for Gradio or API)
53
- # ----------------------------
54
  EXPOSE 7860
55
 
56
- # ----------------------------
57
- # Default command
58
- # ----------------------------
59
  CMD ["python", "app.py"]
 
1
+ # -------------------------
2
+ # 1️⃣ Use Python 3.11 base image
3
+ # -------------------------
4
  FROM python:3.11-slim
5
 
6
+ # -------------------------
7
+ # 2️⃣ Set environment variables
8
+ # -------------------------
9
+ ENV DEBIAN_FRONTEND=noninteractive
10
+ ENV PYTHONUNBUFFERED=1
11
 
12
+ # -------------------------
13
+ # 3️⃣ Install system dependencies
14
+ # -------------------------
15
+ RUN apt-get update && \
16
+ apt-get install -y --no-install-recommends \
17
+ git \
18
+ git-lfs \
19
+ ffmpeg \
20
+ libsm6 \
21
+ libxext6 \
22
+ libgl1 \
23
+ cmake \
24
+ rsync \
25
+ curl \
26
+ build-essential \
27
  && rm -rf /var/lib/apt/lists/* \
28
  && git lfs install
29
 
30
+ # -------------------------
31
+ # 4️⃣ Install Node.js (latest LTS 20)
32
+ # -------------------------
33
+ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
34
+ apt-get install -y nodejs && \
35
+ rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
36
 
37
+ # -------------------------
38
+ # 5️⃣ Upgrade pip and install Python packages
39
+ # -------------------------
40
  COPY requirements.txt /tmp/requirements.txt
41
+ RUN pip install --upgrade pip && \
42
+ pip install --no-cache-dir -r /tmp/requirements.txt
43
+
44
+ # -------------------------
45
+ # 6️⃣ Set work directory
46
+ # -------------------------
47
+ WORKDIR /home/user/app
48
+ COPY . /home/user/app
49
 
50
+ # -------------------------
51
+ # 7️⃣ Set default user
52
+ # -------------------------
53
+ RUN useradd -m -u 1000 user
54
+ USER user
55
 
56
+ # -------------------------
57
+ # 8️⃣ Expose port for Gradio/Flask/etc
58
+ # -------------------------
59
  EXPOSE 7860
60
 
61
+ # -------------------------
62
+ # 9️⃣ Default command
63
+ # -------------------------
64
  CMD ["python", "app.py"]