Spaces:
Running
Running
| # 1. Use a standard Python image | |
| FROM python:3.10-slim | |
| # 2. Set the working directory | |
| WORKDIR /app | |
| # 3. Install critical system dependencies for OpenCV and YOLO | |
| # We use libgl1 instead of libgl1-mesa-glx for better compatibility | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| gcc \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 4. Copy and install Python dependencies | |
| # Now that your file is named 'requirements.txt', this will work | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # 5. Copy your project files | |
| COPY . . | |
| # 6. Set permissions for Hugging Face (User 1000) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # 7. Expose the Hugging Face default port | |
| EXPOSE 7860 | |
| # 8. Start the app | |
| CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false", "--server.enableCORS=false"] | |