File size: 891 Bytes
3fd2a9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
FROM python:3.9-slim

# 2️⃣ Set working directory
WORKDIR /app

# 3️⃣ Install required system dependencies
RUN apt-get update && \
    apt-get install -y libgl1-mesa-glx libglib2.0-0 && \
    rm -rf /var/lib/apt/lists/*

# ⚡️ 3.1️⃣ Set environment variables for cache directories
ENV MPLCONFIGDIR=/tmp/.matplotlib
ENV TRANSFORMERS_CACHE=/tmp/.cache/huggingface

# ⚡️ 3.2️⃣ Create and set permission for cache directories
RUN mkdir -p /tmp/.matplotlib && chmod -R 777 /tmp/.matplotlib
RUN mkdir -p /tmp/.cache/huggingface && chmod -R 777 /tmp/.cache/huggingface

# 4️⃣ Copy requirements
COPY requirements.txt .

# 5️⃣ Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# 6️⃣ Copy all files from the root of your project
COPY . .

# 7️⃣ Expose the port
EXPOSE 7860

# 8️⃣ Command to run the app
CMD ["python", "app.py"]