Spaces:
Running
Running
File size: 1,474 Bytes
3892750 df0de44 7bf3225 b904507 2c7b159 4654abe 34c3fb5 2c7b159 3892750 d1e4b0f 3892750 4dea793 3892750 8be3e16 40e643a 3892750 |
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# Cloned from https://huggingface.co/spaces/limcheekin/bge-small-en-v1.5/tree/main
# Define global args
# ARG MODEL="BAAI/bge-small-en-v1.5"
# ARG MODEL="sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2"
# ARG MODEL="sentence-transformers/all-MiniLM-L12-v2"
# ARG MODEL="moka-ai/m3e-base"
# ARG MODEL="BAAI/bge-small-zh-v1.5"
# ARG MODEL="jinaai/jina-embeddings-v2-base-zh"
ARG MODEL="DMetaSoul/Dmeta-embedding-zh-small"
FROM debian:bullseye-slim AS build-image
# Include global args in this stage of the build
ARG MODEL
ENV MODEL=${MODEL}
COPY ./download.sh ./
# Install build dependencies
RUN apt-get update && \
apt-get install -y git-lfs
RUN chmod +x *.sh && \
./download.sh && \
rm *.sh
# Stage 3 - final runtime image
# Grab a fresh copy of the Python image
FROM python:3.11-slim
# Include global args in this stage of the build
ARG MODEL
ENV MODEL=${MODEL}
ENV NORMALIZE_EMBEDDINGS=1
ENV HF_HOME="/tmp/hf_home"
# Set environment variable for the host
ENV HOST=0.0.0.0
ENV PORT=7860
COPY --from=build-image ${MODEL} ${MODEL}
COPY ./main.py ./
COPY ./start_server.sh ./
# COPY ./index.html ./
RUN pip install --no-cache-dir open-text-embeddings[server] langchain_community && \
chmod +x ./start_server.sh
# 设置环境变量
ENV TRUST_REMOTE_CODE=True
# 安装依赖项
RUN pip install -U langchain-huggingface
# Expose a port for the server
EXPOSE ${PORT}
# Run the server start script
CMD ["/bin/sh", "./start_server.sh"]
|