File size: 1,375 Bytes
081cfa2
 
2dac9cb
 
 
081cfa2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1859ccf
081cfa2
 
 
 
 
ebdf6e0
081cfa2
 
 
 
 
 
 
 
 
 
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
FROM continuumio/miniconda3:23.10.0-1

RUN apt update 
RUN apt install git
RUN git clone https://github.com/xorbitsai/inference.git /
COPY . /opt/inference

ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 14.21.1

RUN apt-get -y update \
  && apt install -y build-essential curl procps git libgl1 \
  && mkdir -p $NVM_DIR \
  && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \
  && . $NVM_DIR/nvm.sh \
  && nvm install $NODE_VERSION \
  && nvm alias default $NODE_VERSION \
  && nvm use default \
  && apt-get -yq clean

ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH

# Copy the entry point script
COPY entrypoint.sh /entrypoint.sh
COPY requirements.txt /requirements.txt
RUN chmod +x /entrypoint.sh

ARG PIP_INDEX=https://pypi.org/simple
RUN python -m pip install --upgrade -i "$PIP_INDEX" pip && \
    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu && \
    pip install -i "$PIP_INDEX" --upgrade-strategy only-if-needed -r /requirements.txt && \
    pip install "llama-cpp-python==0.2.77" --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu && \
    cd /opt/inference && \
    python setup.py build_web && \
    git restore . && \
    pip install -i "$PIP_INDEX" --no-deps "." && \
    # clean packages
    pip cache purge

# 设置ENTRYPOINT
ENTRYPOINT ["/entrypoint.sh"]