# 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 #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 #RUN curl -LO https://huggingface.co/second-state/Llama-3-8B-Instruct-GGUF/resolve/main/Meta-Llama-3-8B-Instruct-Q5_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 # 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.13.5 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 . RUN chmod +x $HOME/app/run.sh # Copy the current directory contents into the container at $HOME/app setting the owner to the user COPY --chown=user . $HOME/app # 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 ENTRYPOINT ./run.sh $CHAT_MODEL_FILE $EMBEDDING_MODEL_FILE $PROMPT_TEMPLATE "$@"