File size: 955 Bytes
0786d00
9ebe953
e5996cb
b92d070
 
0786d00
 
b92d070
 
 
 
 
 
 
 
 
 
 
 
 
ed04c7a
b92d070
0786d00
 
b92d070
 
e1911b7
0786d00
 
 
b92d070
 
8d4d615
b92d070
 
ed04c7a
0786d00
b92d070
 
 
 
 
 
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
# Define global args
ARG MODEL="BAAI/bge-large-en-v1.5"

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

# 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 TRANSFORMERS_CACHE="/tmp/transformers_cache"
# 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"]