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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +51 -53
Dockerfile CHANGED
@@ -1,64 +1,62 @@
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"]
 
 
1
+ FROM docker.io/library/python:3.11@sha256:e3d5b6f5d0b8f7a3c8e9d4c5b2a1f8e7d6c5b4a3f2e1d0c9b8a7f6e5d4c3b2a1
2
+
3
+ # Install system dependencies
4
+ RUN apt-get update && apt-get install -y \
5
+ git \
6
+ git-lfs \
7
+ ffmpeg \
8
+ libsm6 \
9
+ libxext6 \
10
+ cmake \
11
+ rsync \
12
+ libgl1 \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  && rm -rf /var/lib/apt/lists/* \
14
  && git lfs install
15
 
16
+ # Upgrade pip and install base packages
17
+ RUN pip install --no-cache-dir pip -U && \
18
+ pip install --no-cache-dir \
19
+ datasets \
20
+ "huggingface-hub>=0.19" \
21
+ "hf_xet>=1.0.0,<2.0.0" \
22
+ "hf-transfer>=0.1.4" \
23
+ "protobuf<4" \
24
+ "click<8.1" \
25
+ "pydantic==2.10.6"
26
+
27
+ # Set working directory
28
+ WORKDIR /home/user/app
29
+
30
+ # Install fakeroot and setup user
31
+ RUN apt-get update && apt-get install -y fakeroot && \
32
+ mv /usr/bin/apt-get /usr/bin/.apt-get && \
33
+ echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \
34
+ chmod +x /usr/bin/apt-get && \
35
+ rm -rf /var/lib/apt/lists/* && \
36
+ useradd -m -u 1000 user
37
+
38
+ # Install Node.js
39
+ RUN apt-get update && \
40
+ apt-get install -y curl && \
41
+ curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
42
  apt-get install -y nodejs && \
43
+ rm -rf /var/lib/apt/lists/* && apt-get clean
44
 
45
+ # Copy and install requirements
46
+ COPY --chown=1000:1000 requirements.txt /tmp/requirements.txt
47
+ RUN pip install --no-cache-dir -r /tmp/requirements.txt
 
 
 
48
 
49
+ # Copy application files
50
+ COPY --chown=1000:1000 . .
 
 
 
51
 
52
+ # Switch to user
 
 
 
53
  USER user
54
 
55
+ # Expose port (adjust as needed)
 
 
56
  EXPOSE 7860
57
 
58
+ # Set environment variables
59
+ ENV GRADIO_SERVER_NAME="0.0.0.0"
60
+
61
+ # Run the application (adjust command as needed)
62
+ CMD ["python", "app.py"]