| FROM python:3.10-slim | |
| # 安装 OpenCV 和 ONNXRuntime 必要的系统依赖 | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| libgl1 \ | |
| libglib2.0-0 git git-lfs \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /code | |
| # 安装 Python 依赖 | |
| COPY ./requirements.txt /code/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| COPY app.py /code/ | |
| RUN hf download ImgSpace/iLookModels --local-dir /code/ | |
| # 赋予全权限,防止 Hugging Face Space (UID 1000) 读写模型缓存时报 Permission Denied | |
| RUN chmod -R 777 /code | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |