2024-10-02 20:43:16 -07:00
|
|
|
FROM python:3.10 AS builder
|
2024-07-18 14:04:51 -07:00
|
|
|
|
2024-10-02 20:43:16 -07:00
|
|
|
COPY requirements.txt .
|
|
|
|
|
RUN pip install --prefix=/runtime -r requirements.txt
|
2024-07-18 14:04:51 -07:00
|
|
|
|
2024-10-02 20:43:16 -07:00
|
|
|
FROM python:3.10-slim AS output
|
2024-07-18 14:04:51 -07:00
|
|
|
|
2024-10-02 20:43:16 -07:00
|
|
|
# curl is needed for health check in docker-compose
|
|
|
|
|
RUN apt-get update && apt-get install -y curl && apt-get clean && rm -rf /var/lib/apt/lists/*
|
2024-07-18 14:04:51 -07:00
|
|
|
|
2024-10-02 20:43:16 -07:00
|
|
|
COPY --from=builder /runtime /usr/local
|
2024-07-18 14:04:51 -07:00
|
|
|
|
2024-10-02 20:43:16 -07:00
|
|
|
WORKDIR /src
|
2024-07-18 14:04:51 -07:00
|
|
|
|
|
|
|
|
# specify list of models that will go into the image as a comma separated list
|
|
|
|
|
# following models have been tested to work with this image
|
|
|
|
|
# "sentence-transformers/all-MiniLM-L6-v2,sentence-transformers/all-mpnet-base-v2,thenlper/gte-base,thenlper/gte-large,thenlper/gte-small"
|
2024-10-08 14:37:48 -07:00
|
|
|
ENV MODELS="katanemo/bge-large-en-v1.5-onnx"
|
2024-07-18 14:04:51 -07:00
|
|
|
|
2024-10-02 20:43:16 -07:00
|
|
|
COPY ./app ./app
|
2024-10-06 18:21:43 -07:00
|
|
|
COPY ./app/guard_model_config.yaml .
|
|
|
|
|
COPY ./app/openai_params.yaml .
|
2024-07-18 14:04:51 -07:00
|
|
|
|
2024-08-06 23:40:06 -07:00
|
|
|
# comment it out for now as we don't want to download the model every time we build the image
|
|
|
|
|
# we will mount host cache to docker image to avoid downloading the model every time
|
|
|
|
|
# see docker-compose file for more details
|
|
|
|
|
|
2024-07-18 14:04:51 -07:00
|
|
|
# RUN python install.py && \
|
|
|
|
|
# find /root/.cache/torch/sentence_transformers/ -name onnx -exec rm -rf {} +
|
|
|
|
|
|
2024-10-01 09:13:50 -07:00
|
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
|