dhruv2842 commited on
Commit
3fd2a9f
·
verified ·
1 Parent(s): 1d61cf6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -24
Dockerfile CHANGED
@@ -1,24 +1,32 @@
1
- FROM python:3.9-slim
2
-
3
- # 2️⃣ Set working directory
4
- WORKDIR /app
5
-
6
- # 3️⃣ Install required system dependencies (fixes libGL and libgthread errors)
7
- RUN apt-get update && \
8
- apt-get install -y libgl1-mesa-glx libglib2.0-0 && \
9
- rm -rf /var/lib/apt/lists/*
10
-
11
- # 4️⃣ Copy requirements
12
- COPY requirements.txt .
13
-
14
- # 5️⃣ Install Python dependencies
15
- RUN pip install --no-cache-dir -r requirements.txt
16
-
17
- # 6️⃣ Copy all files from the root of your project
18
- COPY . .
19
-
20
- # 7️⃣ Expose the port
21
- EXPOSE 7860
22
-
23
- # 8️⃣ Command to run the app
24
- CMD ["python", "app.py"]
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ # 2️⃣ Set working directory
4
+ WORKDIR /app
5
+
6
+ # 3️⃣ Install required system dependencies
7
+ RUN apt-get update && \
8
+ apt-get install -y libgl1-mesa-glx libglib2.0-0 && \
9
+ rm -rf /var/lib/apt/lists/*
10
+
11
+ # ⚡️ 3.1️⃣ Set environment variables for cache directories
12
+ ENV MPLCONFIGDIR=/tmp/.matplotlib
13
+ ENV TRANSFORMERS_CACHE=/tmp/.cache/huggingface
14
+
15
+ # ⚡️ 3.2️⃣ Create and set permission for cache directories
16
+ RUN mkdir -p /tmp/.matplotlib && chmod -R 777 /tmp/.matplotlib
17
+ RUN mkdir -p /tmp/.cache/huggingface && chmod -R 777 /tmp/.cache/huggingface
18
+
19
+ # 4️⃣ Copy requirements
20
+ COPY requirements.txt .
21
+
22
+ # 5️⃣ Install Python dependencies
23
+ RUN pip install --no-cache-dir -r requirements.txt
24
+
25
+ # 6️⃣ Copy all files from the root of your project
26
+ COPY . .
27
+
28
+ # 7️⃣ Expose the port
29
+ EXPOSE 7860
30
+
31
+ # 8️⃣ Command to run the app
32
+ CMD ["python", "app.py"]