Update Dockerfile
Browse files- 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
|
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 |
-
#
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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"]
|