Spaces:
Running
Running
File size: 999 Bytes
0e2d107 9aa0a4f 0e2d107 9aa0a4f 0e2d107 9aa0a4f 0e2d107 9aa0a4f 0e2d107 9aa0a4f 0e2d107 9aa0a4f 0e2d107 9aa0a4f 0e2d107 9aa0a4f 0e2d107 | 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 | # 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"]
|