Alex0007 commited on
Commit
859ea12
1 Parent(s): 43b8c19

更新了一下Dockerfile

Browse files
Files changed (3) hide show
  1. Dockerfile +5 -20
  2. README.md +1 -1
  3. config.toml +0 -2
Dockerfile CHANGED
@@ -1,48 +1,33 @@
1
- # Using a standard Ubuntu base image
2
  FROM ubuntu:22.04
3
 
4
- # Environment variables
5
  ENV MODEL_NAME="Qwen-7B-gguf"
6
  ENV MODEL_FILE="qwen7b-q4_0.gguf"
7
  ENV MODEL_USER="MatrixStudio"
8
  ENV DEFAULT_MODEL_BRANCH="main"
9
  ENV MODEL_URL="https://huggingface.co/${MODEL_USER}/${MODEL_NAME}/resolve/${DEFAULT_MODEL_BRANCH}/${MODEL_FILE}"
10
 
11
- # Installing necessary packages
12
- RUN apt-get update && apt-get upgrade -y \
13
- && apt-get install -y build-essential python3 python3-pip wget curl git \
14
- --no-install-recommends \
15
- && apt-get clean && rm -rf /var/lib/apt/lists/*
16
 
17
- # Setting up the working directory
18
  WORKDIR /app
19
 
20
-
21
  COPY ./requirements.txt /app/requirements.txt
22
  RUN pip install --upgrade pip && pip install --no-cache-dir --upgrade -r /app/requirements.txt
23
 
24
-
25
- # Cloning the llama.cpp repository
26
  RUN git clone https://github.com/ggerganov/llama.cpp.git
27
-
28
- # Moving to the llama.cpp directory and building the project
29
  WORKDIR /app/llama.cpp
30
  RUN make
31
 
32
- # Model download process
33
  RUN mkdir -p models/7B && wget -O models/7B/${MODEL_FILE} ${MODEL_URL}
34
 
35
- # Changing ownership to a non-root user
36
  RUN useradd -m -u 1000 user && chown -R user:user /app
37
  USER user
38
  ENV HOME=/home/user
39
  ENV PATH=/home/user/.local/bin:$PATH
40
  RUN chmod -R 777 /app/llama.cpp
41
 
42
- # Setting up the application
43
- EXPOSE 8080
44
 
45
  # Adjust the CMD to use the absolute path of the server executable
46
- # CMD ["/app/llama.cpp/server", "-m", "/app/llama.cpp/models/7B/qwen7b-q4_0.gguf", "-c", "16000", "--host", "0.0.0.0", "--port", "8000"]
47
- # CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
48
- CMD ["python3", "-m", "llama_cpp.server", "--model", "/app/llama.cpp/models/7B/qwen7b-q4_0.gguf", "--host", "0.0.0.0", "--port", "8000", "--n_threads", "16"]
 
 
1
  FROM ubuntu:22.04
2
 
 
3
  ENV MODEL_NAME="Qwen-7B-gguf"
4
  ENV MODEL_FILE="qwen7b-q4_0.gguf"
5
  ENV MODEL_USER="MatrixStudio"
6
  ENV DEFAULT_MODEL_BRANCH="main"
7
  ENV MODEL_URL="https://huggingface.co/${MODEL_USER}/${MODEL_NAME}/resolve/${DEFAULT_MODEL_BRANCH}/${MODEL_FILE}"
8
 
9
+ RUN apt-get update && apt-get upgrade -y && apt-get install -y build-essential python3 python3-pip wget curl git
 
 
 
 
10
 
 
11
  WORKDIR /app
12
 
 
13
  COPY ./requirements.txt /app/requirements.txt
14
  RUN pip install --upgrade pip && pip install --no-cache-dir --upgrade -r /app/requirements.txt
15
 
 
 
16
  RUN git clone https://github.com/ggerganov/llama.cpp.git
 
 
17
  WORKDIR /app/llama.cpp
18
  RUN make
19
 
 
20
  RUN mkdir -p models/7B && wget -O models/7B/${MODEL_FILE} ${MODEL_URL}
21
 
 
22
  RUN useradd -m -u 1000 user && chown -R user:user /app
23
  USER user
24
  ENV HOME=/home/user
25
  ENV PATH=/home/user/.local/bin:$PATH
26
  RUN chmod -R 777 /app/llama.cpp
27
 
28
+ EXPOSE 7860
 
29
 
30
  # Adjust the CMD to use the absolute path of the server executable
31
+ # CMD ["/app/llama.cpp/server", "-m", "/app/llama.cpp/models/7B/qwen7b-q4_0.gguf", "-c", "16000", "--host", "0.0.0.0", "--port", "7860"]
32
+ # CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
33
+ CMD ["python3", "-m", "llama_cpp.server", "--model", "/app/llama.cpp/models/7B/qwen7b-q4_0.gguf", "--host", "0.0.0.0", "--port", "7860", "--n_threads", "16"]
README.md CHANGED
@@ -4,6 +4,6 @@ emoji: 🦍⨐
4
  colorFrom: green
5
  colorTo: yellow
6
  sdk: docker
7
- app_port: 8080
8
  pinned: false
9
  ---
 
4
  colorFrom: green
5
  colorTo: yellow
6
  sdk: docker
7
+ app_port: 7860
8
  pinned: false
9
  ---
config.toml DELETED
@@ -1,2 +0,0 @@
1
- model="/app/llama.cpp/models/7B/qwen7b-q4_0.gguf"
2
- n_threads="1"