Spaces:
Running
Running
Commit
·
3c1c3de
1
Parent(s):
d34af22
Dockerfile now installs models directly into user folder instead of moving from base folder
Browse files- Dockerfile +13 -14
Dockerfile
CHANGED
|
@@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y \
|
|
| 11 |
build-essential
|
| 12 |
|
| 13 |
# Create a directory for the model
|
| 14 |
-
RUN mkdir /model
|
| 15 |
|
| 16 |
WORKDIR /src
|
| 17 |
|
|
@@ -22,19 +22,6 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
| 22 |
# Gradio needs to be installed after due to conflict with spacy in requirements
|
| 23 |
RUN pip install --no-cache-dir gradio==4.41.0
|
| 24 |
|
| 25 |
-
# Download the quantised phi model directly with curl
|
| 26 |
-
RUN curl -L -o Phi-3-mini-128k-instruct.Q4_K_M.gguf https://huggingface.co/QuantFactory/Phi-3-mini-128k-instruct-GGUF/tree/main/Phi-3-mini-128k-instruct.Q4_K_M.gguf
|
| 27 |
-
|
| 28 |
-
# If needed, move the file to your desired directory in the Docker image
|
| 29 |
-
RUN mv Phi-3-mini-128k-instruct.Q4_K_M.gguf /model/rep/
|
| 30 |
-
|
| 31 |
-
# Download the Mixed bread embedding model during the build process
|
| 32 |
-
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
|
| 33 |
-
RUN apt-get install git-lfs -y
|
| 34 |
-
RUN git lfs install
|
| 35 |
-
RUN git clone https://huggingface.co/mixedbread-ai/mxbai-embed-large-v1 /model/embed
|
| 36 |
-
RUN rm -rf /model/embed/.git
|
| 37 |
-
|
| 38 |
# Set up a new user named "user" with user ID 1000
|
| 39 |
RUN useradd -m -u 1000 user
|
| 40 |
|
|
@@ -45,6 +32,18 @@ RUN chown -R user:user /home/user
|
|
| 45 |
RUN mkdir -p /home/user/app/output && chown -R user:user /home/user/app/output
|
| 46 |
RUN mkdir -p /home/user/.cache/huggingface/hub && chown -R user:user /home/user/.cache/huggingface/hub
|
| 47 |
RUN mkdir -p /home/user/.cache/matplotlib && chown -R user:user /home/user/.cache/matplotlib
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
# Switch to the "user" user
|
| 50 |
USER user
|
|
|
|
| 11 |
build-essential
|
| 12 |
|
| 13 |
# Create a directory for the model
|
| 14 |
+
RUN mkdir /model && mkdir /model/rep && mkdir /model/embed
|
| 15 |
|
| 16 |
WORKDIR /src
|
| 17 |
|
|
|
|
| 22 |
# Gradio needs to be installed after due to conflict with spacy in requirements
|
| 23 |
RUN pip install --no-cache-dir gradio==4.41.0
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
# Set up a new user named "user" with user ID 1000
|
| 26 |
RUN useradd -m -u 1000 user
|
| 27 |
|
|
|
|
| 32 |
RUN mkdir -p /home/user/app/output && chown -R user:user /home/user/app/output
|
| 33 |
RUN mkdir -p /home/user/.cache/huggingface/hub && chown -R user:user /home/user/.cache/huggingface/hub
|
| 34 |
RUN mkdir -p /home/user/.cache/matplotlib && chown -R user:user /home/user/.cache/matplotlib
|
| 35 |
+
RUN mkdir -p /home/user/app/model/rep && chown -R user:user /home/user/app/model/rep
|
| 36 |
+
RUN mkdir -p /home/user/app/model/embed && chown -R user:user /home/user/app/model/embed
|
| 37 |
+
|
| 38 |
+
# Download the quantised phi model directly with curl
|
| 39 |
+
RUN curl -L -o /home/user/app/model/rep/Phi-3-mini-128k-instruct.Q4_K_M.gguf https://huggingface.co/QuantFactory/Phi-3-mini-128k-instruct-GGUF/tree/main/Phi-3-mini-128k-instruct.Q4_K_M.gguf
|
| 40 |
+
|
| 41 |
+
# Download the Mixed bread embedding model during the build process
|
| 42 |
+
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
|
| 43 |
+
RUN apt-get install git-lfs -y
|
| 44 |
+
RUN git lfs install
|
| 45 |
+
RUN git clone https://huggingface.co/mixedbread-ai/mxbai-embed-large-v1 /home/user/app/model/embed
|
| 46 |
+
RUN rm -rf /home/user/app/model/embed/.git
|
| 47 |
|
| 48 |
# Switch to the "user" user
|
| 49 |
USER user
|