Download Dockerfile from edusocial/e5-small-embedding-server: direct link, hf CLI and curl.
- Browser
- Download file 927 Bytes
-
https://huggingface.co/spaces/edusocial/e5-small-embedding-server/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/edusocial/e5-small-embedding-server/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/edusocial/e5-small-embedding-server/resolve/main/Dockerfile
927 Bytes
| FROM python:3.10-slim | |
| WORKDIR /app | |
| # 安装系统依赖 | |
| RUN apt-get update && apt-get install -y git wget ffmpeg && rm -rf /var/lib/apt/lists/* | |
| # 安装 PyTorch CPU 版本 | |
| RUN pip install --no-cache-dir torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu | |
| # 安装依赖 | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # 安装 huggingface_hub 用来下载模型 | |
| RUN pip install --no-cache-dir huggingface_hub | |
| # ✅ 下载 e5-small 模型而不是 BGE-M3 | |
| RUN python -c "from huggingface_hub import snapshot_download; snapshot_download('intfloat/e5-small', local_dir='/app/model')" | |
| # 环境变量:指定模型路径 | |
| ENV MODEL_PATH=/app/model | |
| ENV DEVICE=cpu | |
| ENV TRANSFORMERS_CACHE=/app/hf_cache | |
| ENV HF_HOME=/app/hf_cache | |
| RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache | |
| COPY app app | |
| EXPOSE 8000 | |
| CMD uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-7860} | |