FROM debian:bullseye-slim AS build-image ARG MODEL="BAAI/bge-large-en" 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.10-slim ARG MODEL="BAAI/bge-large-en" ENV MODEL=${MODEL} ENV NORMALIZE_EMBEDDINGS=1 RUN mkdir -p ${MODEL} && mkdir -p open/text/embeddings COPY --from=build-image ${MODEL} ${MODEL} COPY open/text/embeddings ./open/text/embeddings COPY server-requirements.txt ./ RUN pip install --no-cache-dir -r server-requirements.txt COPY ./start_server.sh ./ COPY ./index.html ./ # Make the server start script executable RUN chmod +x ./start_server.sh # Set environment variable for the host ENV HOST=0.0.0.0 ENV PORT=7860 # Expose a port for the server EXPOSE ${PORT} # Run the server start script CMD ["/bin/sh", "./start_server.sh"]