matthoffner commited on
Commit
93551c4
·
verified ·
1 Parent(s): 9b66bd9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -33
Dockerfile CHANGED
@@ -1,5 +1,7 @@
1
- FROM ghcr.io/abetlen/llama-cpp-python:latest
 
2
 
 
3
  ENV MODEL_NAME="llava-1.6-mistral-7b-gguf"
4
  ENV DEFAULT_MODEL_FILE="llava-v1.6-mistral-7b.Q3_K_XS.gguf"
5
  ENV MODEL_USER="cjpais"
@@ -8,42 +10,22 @@ ENV DEFAULT_CLIP_MODEL_FILE="mmproj-model-f16.gguf"
8
  ENV MODEL_URL="https://huggingface.co/${MODEL_USER}/${MODEL_NAME}/resolve/${DEFAULT_MODEL_BRANCH}/${DEFAULT_MODEL_FILE}"
9
  ENV CLIP_MODEL_URL="https://huggingface.co/${MODEL_USER}/${MODEL_NAME}/resolve/${DEFAULT_MODEL_BRANCH}/${DEFAULT_CLIP_MODEL_FILE}"
10
 
11
- ENV DEBIAN_FRONTEND=noninteractive
12
-
13
- RUN apt update && \
14
- apt install --no-install-recommends -y build-essential python3 python3-pip wget curl git && \
15
- apt clean && rm -rf /var/lib/apt/lists/*
16
-
17
  WORKDIR /app
18
 
19
- COPY requirements.txt ./
20
-
21
- RUN python3 -m pip install --upgrade pip && \
22
- pip install -r requirements.txt
23
-
24
- # Downloading the models
25
- RUN echo ${MODEL_URL} && \
26
- wget -O /app/${DEFAULT_MODEL_FILE} ${MODEL_URL} && \
27
- echo ${CLIP_MODEL_URL} && \
28
- wget -O /app/${DEFAULT_CLIP_MODEL_FILE} ${CLIP_MODEL_URL}
29
-
30
- # Creating a non-root user
31
- #RUN mkdir -p /home/user/app && \
32
- # mv /app/${DEFAULT_MODEL_FILE} /home/user/app && \
33
- # mv /app/${DEFAULT_CLIP_MODEL_FILE} /home/user/app && \
34
- # chown -R user:user /home/user/app
35
-
36
- #USER user
37
- #ENV HOME=/home/user \
38
- # PATH=/home/user/.local/bin:$PATH
39
-
40
- #WORKDIR $HOME/app
41
 
42
- # Copying the rest of your application
43
- # COPY --chown=user . .
44
 
45
- RUN ls -al
 
 
46
 
 
47
  EXPOSE 8000
48
 
49
- CMD ["python3", "-m", "llama_cpp.server", "--model", "llava-v1.6-mistral-7b.Q3_K_XS.gguf", "--clip_model_path", "mmproj-model-f16.gguf", "--chat_format", "llava-1-5"]
 
 
1
+ # Using the specified base image that's suited for llama-cpp-python
2
+ FROM ghcr.io/abetlen/llama-cpp-python:latest@sha256:b6d21ff8c4d9baad65e1fa741a0f8c898d68735fff3f3cd777e3f0c6a1839dd4
3
 
4
+ # Environment variables for model details
5
  ENV MODEL_NAME="llava-1.6-mistral-7b-gguf"
6
  ENV DEFAULT_MODEL_FILE="llava-v1.6-mistral-7b.Q3_K_XS.gguf"
7
  ENV MODEL_USER="cjpais"
 
10
  ENV MODEL_URL="https://huggingface.co/${MODEL_USER}/${MODEL_NAME}/resolve/${DEFAULT_MODEL_BRANCH}/${DEFAULT_MODEL_FILE}"
11
  ENV CLIP_MODEL_URL="https://huggingface.co/${MODEL_USER}/${MODEL_NAME}/resolve/${DEFAULT_MODEL_BRANCH}/${DEFAULT_CLIP_MODEL_FILE}"
12
 
13
+ # Set up the working directory
 
 
 
 
 
14
  WORKDIR /app
15
 
16
+ # Ensure curl is available for downloading the models
17
+ RUN apt-get update && apt-get install -y curl && \
18
+ apt-get clean && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
+ # Create a directory for the models
21
+ RUN mkdir -p /models
22
 
23
+ # Download the models
24
+ RUN curl -L "${MODEL_URL}" -o /models/${DEFAULT_MODEL_FILE} && \
25
+ curl -L "${CLIP_MODEL_URL}" -o /models/${DEFAULT_CLIP_MODEL_FILE}
26
 
27
+ # Expose the port the server will run on
28
  EXPOSE 8000
29
 
30
+ # Command to run the server, using environment variables for model paths
31
+ CMD ["python3", "-m", "llama_cpp.server", "--model", "/models/llava-v1.6-mistral-7b.Q3_K_XS.gguf", "--clip_model_path", "/models/mmproj-model-f16.gguf", "--chat_format", "llava-1-5"]