File size: 1,030 Bytes
d9b7c51
f764600
 
d9b7c51
 
f764600
d9b7c51
f764600
 
 
 
d9b7c51
f764600
d9b7c51
 
f764600
d9b7c51
 
f764600
 
 
d9b7c51
f764600
 
d9b7c51
f764600
d9b7c51
 
f764600
 
d9b7c51
f764600
 
d9b7c51
f764600
 
d9b7c51
f764600
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
34
35
36
37
38
# Use the official Python 3.10 slim image
FROM python:3.10-slim

# 1. Install system dependencies
# FIXED: Replaced 'libgl1-mesa-glx' (deprecated) with 'libgl1'
RUN apt-get update && apt-get install -y \
    libgl1 \
    libglib2.0-0 \
    git \
    && rm -rf /var/lib/apt/lists/*

# 2. Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user

# Switch to the "user" context
USER user

# Set home environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# 3. Set the working directory
WORKDIR $HOME/app

# 4. Copy requirements file first (Better for caching)
COPY --chown=user requirements.txt requirements.txt

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# 5. Copy the rest of your application code
COPY --chown=user . .

# 6. Expose the port Hugging Face expects
EXPOSE 7860

# 7. Run the Streamlit application
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]