# 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 "$@"