Spaces:
Running
Running
# 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" | |
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] && \ | |
chmod +x ./start_server.sh | |
# Expose a port for the server | |
EXPOSE ${PORT} | |
# Run the server start script | |
CMD ["/bin/sh", "./start_server.sh"] | |