zhengr commited on
Commit
209ff3f
·
verified ·
1 Parent(s): e06046e

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +53 -0
Dockerfile ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM continuumio/miniconda3:23.10.0-1
2
+
3
+ RUN apt update
4
+ RUN apt install git
5
+ RUN git clone https://github.com/xorbitsai/inference.git
6
+ RUN cd inference
7
+ WORKDIR inference
8
+
9
+ ENV NVM_DIR /usr/local/nvm
10
+ ENV NODE_VERSION 14.21.1
11
+
12
+ RUN apt-get -y update \
13
+ && apt install -y build-essential curl procps git libgl1 \
14
+ && mkdir -p $NVM_DIR \
15
+ && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash \
16
+ && . $NVM_DIR/nvm.sh \
17
+ && nvm install $NODE_VERSION \
18
+ && nvm alias default $NODE_VERSION \
19
+ && nvm use default \
20
+ && apt-get -yq clean
21
+
22
+ ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
23
+
24
+ # Copy the entry point script
25
+ COPY ./entrypoint.sh inference/entrypoint.sh
26
+
27
+ ARG PIP_INDEX=https://pypi.org/simple
28
+ RUN python -m pip install --upgrade -i "$PIP_INDEX" pip && \
29
+ pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu && \
30
+ pip install -i "$PIP_INDEX" --upgrade-strategy only-if-needed -r /inference/xinference/deploy/docker/requirements_cpu.txt && \
31
+ pip install "llama-cpp-python==0.2.77" --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu && \
32
+ cd /inference && \
33
+ python setup.py build_web && \
34
+ git restore . && \
35
+ pip install -i "$PIP_INDEX" --no-deps "." && \
36
+ # clean packages
37
+ pip cache purge
38
+
39
+ RUN useradd -m -u 1000 user
40
+ USER user
41
+ ENV HOME=/home/user \
42
+ PATH=/home/user/.local/bin:$PATH
43
+ WORKDIR $HOME/app
44
+ COPY --chown=user . $HOME/app
45
+
46
+ RUN pwd
47
+ RUN ls
48
+
49
+ EXPOSE 9997
50
+
51
+ # 设置ENTRYPOINT
52
+ RUN chmod +x /home/user/app/entrypoint.sh
53
+ ENTRYPOINT ["sh", "/home/user/app/entrypoint.sh"]