Spaces:
Running
Running
| # 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"] |