CooLLaMACEO commited on
Commit
5ddd6af
·
verified ·
1 Parent(s): 4cd1eae

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -12
Dockerfile CHANGED
@@ -1,22 +1,22 @@
1
- FROM python:3.10-bullseye
 
2
 
3
  WORKDIR /app
4
 
5
- # Install only the essentials
6
  RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
7
 
8
- # Force PIP to use CPU-only binaries and avoid the build-stage entirely
9
- ENV PIP_PREFER_BINARY=1
10
- RUN pip install --no-cache-dir fastapi uvicorn
11
- RUN pip install llama-cpp-python \
12
- --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
13
-
14
- # Download the model (MPT-7B Q2)
15
- # We do this AFTER the install so if the model fails, we don't have to reinstall tools
16
- RUN curl -L "https://huggingface.co/maddes8cht/mosaicml-mpt-7b-chat-gguf/resolve/main/mosaicml-mpt-7b-chat-Q2_K.gguf?download=true" -o mpt-7b-q2.gguf
17
 
 
18
  COPY app.py .
19
 
 
 
20
  EXPOSE 7860
21
 
22
- CMD ["python", "app.py"]
 
 
1
+ # Use the official pre-compiled image (CPU version)
2
+ FROM ghcr.io/abetlen/llama-cpp-python:latest
3
 
4
  WORKDIR /app
5
 
6
+ # 1. Install curl and move to the right folder
7
  RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
8
 
9
+ # 2. Download the model using the CLI (most stable)
10
+ RUN pip install huggingface_hub
11
+ RUN huggingface-cli download maddes8cht/mosaicml-mpt-7b-chat-gguf mosaicml-mpt-7b-chat-Q2_K.gguf --local-dir . --local-dir-use-symlinks False
12
+ RUN mv mosaicml-mpt-7b-chat-Q2_K.gguf mpt-7b-q2.gguf
 
 
 
 
 
13
 
14
+ # 3. Copy your app code
15
  COPY app.py .
16
 
17
+ # Force the port to 7860 for Hugging Face
18
+ ENV PORT=7860
19
  EXPOSE 7860
20
 
21
+ # Use the python inside the container to run your app
22
+ CMD ["python3", "app.py"]