File size: 930 Bytes
6bdb28a
 
46c8c69
69734eb
6bdb28a
46c8c69
6bdb28a
 
46c8c69
6bdb28a
69734eb
46c8c69
 
6bdb28a
46c8c69
 
 
6bdb28a
46c8c69
 
6bdb28a
 
46c8c69
6bdb28a
 
96c6e68
 
 
 
 
 
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
# 1. Use a stable, lightweight Python image
FROM python:3.11-slim

# 2. Set the working directory
WORKDIR /code

# 3. Install only the essential libraries for image processing
# These replace the old mesa-glx package that caused your error
RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# 4. Copy and install requirements (Cache optimized)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# 5. Copy your app.py and any other files
COPY . .

# 6. Expose the standard port for Streamlit
EXPOSE 7860

# 7. Run the app
# Using 7860 as the port makes it compatible with Hugging Face Spaces
# Start the app with security flags to prevent the 403 AxiosError
CMD ["streamlit", "run", "app.py", \
    "--server.port", "7860", \
    "--server.address", "0.0.0.0", \
    "--server.enableCORS", "false", \
    "--server.enableXsrfProtection", "false"]