Spaces:
Sleeping
Sleeping
File size: 707 Bytes
45f32de | 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 | FROM python:3.10-slim
# HF Spaces runs as a non-root user — this satisfies that requirement
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Install system deps needed by OpenCV
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 libglib2.0-0 libsm6 libxrender1 libxext6 \
&& rm -rf /var/lib/apt/lists/*
USER user
# Install Python deps
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy app source and model files
COPY --chown=user server.py .
COPY --chown=user models/ ./models/
# HF Spaces expects the app to listen on port 7860
EXPOSE 7860
CMD ["python", "server.py"]
|