File size: 2,263 Bytes
ab1439e
 
 
0383b54
ab1439e
 
 
0383b54
ab1439e
 
 
0383b54
a017f96
0383b54
8ac1be9
 
 
ce29d34
cf45bb0
db291a1
 
 
 
 
 
 
 
 
 
ce29d34
db291a1
 
b299a1e
9784d17
b299a1e
ee01f34
db291a1
 
 
 
 
2a59be0
c2ab046
ab1439e
ce338c6
ab1439e
db291a1
ce338c6
 
db291a1
e2d4031
 
db291a1
ce29d34
 
d840317
ff51f98
8dc3174
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# syntax=docker/dockerfile:1

FROM ubuntu:22.04

ARG CHAT_MODEL_FILE
ARG EMBEDDING_MODEL_FILE
ARG PROMPT_TEMPLATE

ENV CHAT_MODEL_FILE=${CHAT_MODEL_FILE}
ENV EMBEDDING_MODEL_FILE=${EMBEDDING_MODEL_FILE}
ENV PROMPT_TEMPLATE=${PROMPT_TEMPLATE}

RUN apt-get update && apt-get install -y curl && apt-get install -y libopenblas-dev

#COPY $CHAT_MODEL_FILE /models/$CHAT_MODEL_FILE
#COPY $EMBEDDING_MODEL_FILE /models/$EMBEDDING_MODEL_FILE

#RUN mkdir /app && chmod -R 777 /app && cd /app

# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user

# Switch to the "user" user
USER user

# Set home to the user's home directory
ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH

#RUN mkdir $HOME/models && cd $HOME/models
# Set the working directory to the user's home directory
WORKDIR $HOME/models
#ADD --chown=user https://huggingface.co/second-state/Nomic-embed-text-v1.5-Embedding-GGUF/resolve/main/nomic-embed-text-v1.5-f16.gguf $HOME/models
RUN curl -LO https://huggingface.co/zhengr/Meta-Llama-3.1-8B-GGUF/resolve/main/meta-llama-3.1-8b.Q4_K_M.gguf
RUN curl -LO https://huggingface.co/second-state/Nomic-embed-text-v1.5-Embedding-GGUF/resolve/main/nomic-embed-text-v1.5-f16.gguf
RUN ls $HOME/models

# Set the working directory to the user's home directory
WORKDIR $HOME/app

# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
RUN curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install_v2.sh | bash -s -- -v 0.14.0
RUN curl -LO https://github.com/LlamaEdge/LlamaEdge/releases/latest/download/llama-api-server.wasm
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
#COPY run.sh .

# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app
RUN chmod +x run.sh

ENV SERVER_ROOT_PATH="/api"

# Download a checkpoint
#RUN mkdir content
#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
EXPOSE 8080

ENTRYPOINT $HOME/app/run.sh $CHAT_MODEL_FILE $EMBEDDING_MODEL_FILE $PROMPT_TEMPLATE "$@"