zhengr commited on
Commit
db291a1
·
verified ·
1 Parent(s): 1ead272

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -4
Dockerfile CHANGED
@@ -11,20 +11,46 @@ ENV EMBEDDING_MODEL_FILE=${EMBEDDING_MODEL_FILE}
11
  ENV PROMPT_TEMPLATE=${PROMPT_TEMPLATE}
12
 
13
  RUN apt-get update && apt-get install -y curl
14
- RUN mkdir /models && cd /models
15
-
16
- #RUN curl -LO https://huggingface.co/second-state/Llama-3-8B-Instruct-GGUF/resolve/main/Meta-Llama-3-8B-Instruct-Q5_K_M.gguf
17
- #RUN curl -LO https://huggingface.co/second-state/Nomic-embed-text-v1.5-Embedding-GGUF/resolve/main/nomic-embed-text-v1.5-f16.gguf
18
 
19
  #COPY $CHAT_MODEL_FILE /models/$CHAT_MODEL_FILE
20
  #COPY $EMBEDDING_MODEL_FILE /models/$EMBEDDING_MODEL_FILE
21
 
22
  RUN mkdir /app && chmod -R 777 /app && cd /app
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  RUN curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install_v2.sh | bash -s -- -v 0.13.5
25
  RUN curl -LO https://github.com/LlamaEdge/LlamaEdge/releases/latest/download/llama-api-server.wasm
26
  RUN curl -LO https://github.com/second-state/chatbot-ui/releases/latest/download/chatbot-ui.tar.gz; tar xzf chatbot-ui.tar.gz; rm chatbot-ui.tar.gz
27
  COPY run.sh .
28
  RUN chmod +x run.sh
29
 
 
 
 
 
 
 
 
30
  ENTRYPOINT ./run.sh $CHAT_MODEL_FILE $EMBEDDING_MODEL_FILE $PROMPT_TEMPLATE "$@"
 
11
  ENV PROMPT_TEMPLATE=${PROMPT_TEMPLATE}
12
 
13
  RUN apt-get update && apt-get install -y curl
 
 
 
 
14
 
15
  #COPY $CHAT_MODEL_FILE /models/$CHAT_MODEL_FILE
16
  #COPY $EMBEDDING_MODEL_FILE /models/$EMBEDDING_MODEL_FILE
17
 
18
  RUN mkdir /app && chmod -R 777 /app && cd /app
19
 
20
+
21
+
22
+ # Set up a new user named "user" with user ID 1000
23
+ RUN useradd -m -u 1000 user
24
+
25
+ # Switch to the "user" user
26
+ USER user
27
+
28
+ # Set home to the user's home directory
29
+ ENV HOME=/home/user \
30
+ PATH=/home/user/.local/bin:$PATH
31
+
32
+ RUN mkdir $HOME/models && cd $HOME/models
33
+ # Set the working directory to the user's home directory
34
+ WORKDIR $HOME/models
35
+
36
+ #RUN curl -LO https://huggingface.co/second-state/Llama-3-8B-Instruct-GGUF/resolve/main/Meta-Llama-3-8B-Instruct-Q5_K_M.gguf
37
+ #RUN curl -LO https://huggingface.co/second-state/Nomic-embed-text-v1.5-Embedding-GGUF/resolve/main/nomic-embed-text-v1.5-f16.gguf
38
+
39
+ # Set the working directory to the user's home directory
40
+ WORKDIR $HOME/app
41
+
42
+ # Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
43
  RUN curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install_v2.sh | bash -s -- -v 0.13.5
44
  RUN curl -LO https://github.com/LlamaEdge/LlamaEdge/releases/latest/download/llama-api-server.wasm
45
  RUN curl -LO https://github.com/second-state/chatbot-ui/releases/latest/download/chatbot-ui.tar.gz; tar xzf chatbot-ui.tar.gz; rm chatbot-ui.tar.gz
46
  COPY run.sh .
47
  RUN chmod +x run.sh
48
 
49
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
50
+ COPY --chown=user . $HOME/app
51
+
52
+ # Download a checkpoint
53
+ RUN mkdir content
54
+ ADD --chown=user https://huggingface.co/second-state/Nomic-embed-text-v1.5-Embedding-GGUF/resolve/main/nomic-embed-text-v1.5-f16.gguf content/models
55
+
56
  ENTRYPOINT ./run.sh $CHAT_MODEL_FILE $EMBEDDING_MODEL_FILE $PROMPT_TEMPLATE "$@"