Spaces:
Sleeping
Sleeping
| FROM python:3.12-slim | |
| # System deps (add build-essential + common runtime libs for OpenCV/ONNX) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential gcc g++ make cmake pkg-config \ | |
| libgl1 libglib2.0-0 libsm6 libxext6 libxrender1 libgomp1 git curl && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Workspace & writable directories | |
| ENV APP_HOME=/workspace | |
| RUN mkdir -p $APP_HOME/app $APP_HOME/data $APP_HOME/cache && chmod -R 777 $APP_HOME | |
| WORKDIR $APP_HOME | |
| # (Optional but helps some builds) | |
| ENV CC=gcc CXX=g++ | |
| ENV INSIGHTFACE_HOME=/workspace/cache/insightface | |
| ENV MPLCONFIGDIR=/workspace/cache/matplotlib | |
| # Python deps | |
| COPY requirements.txt ./requirements.txt | |
| # Pre-install numpy so headers are ready during builds | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir "numpy<2.0; python_version<'3.12'" "numpy>=2.0; python_version>='3.12'" && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # App | |
| COPY app ./app | |
| COPY run.sh ./run.sh | |
| RUN chmod +x ./run.sh | |
| ENV PORT=7860 | |
| CMD ["./run.sh"] | |