Spaces:
Sleeping
Sleeping
File size: 755 Bytes
eb99bc8 | 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 | # Use standard python image
FROM python:3.9-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Create user with ID 1000
RUN useradd -m -u 1000 user
# Set working directory
WORKDIR /app
# Copy requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Download model during build to avoid runtime permission errors
RUN pip install ultralytics && \
python -c "from ultralytics import YOLO; YOLO('yolov8n.pt')"
# Copy app code and CHANGE OWNER to user
COPY --chown=user . .
# Switch to user
USER user
ENV PATH="/home/user/.local/bin:$PATH" \
PORT=7860
# Expose port
EXPOSE 7860
# Run Flask
CMD ["python", "app.py"] |