Spaces:
Running
Running
File size: 715 Bytes
b16e4fc | 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 | FROM python:3.11-slim
# System libs for Pillow + ONNX Runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 libglib2.0-0 libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# HF Spaces convention: non-root user named "user" with UID 1000
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
HOST=0.0.0.0 \
PORT=7860
WORKDIR /home/user/app
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Pre-download U-2-Net so the first /trace request is instant.
RUN python -c "from rembg import new_session; new_session('u2net')"
COPY --chown=user . .
EXPOSE 7860
CMD ["python", "app.py"]
|