Drakkarious commited on
Commit
c4e25ba
·
verified ·
1 Parent(s): fc42564

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -20
Dockerfile CHANGED
@@ -1,29 +1,22 @@
1
- FROM python:3.10-bookworm
 
2
 
3
- # 1. Install system requirements
4
- RUN apt-get update && apt-get install -y \
5
- curl git procps libopenblas-dev \
6
- && rm -rf /var/lib/apt/lists/*
7
 
8
- # 2. Set up user (HF requires UID 1000)
9
  RUN useradd -m -u 1000 user
10
- ENV HOME=/home/user \
11
- PATH=/home/user/.local/bin:$PATH
12
- WORKDIR $HOME/app
13
 
14
- # 3. Pre-create model directory
15
- RUN mkdir -p $HOME/app/model_cache && chown -R user:user $HOME/app
16
- USER user
17
-
18
- # 4. Install Gradio first to establish the web server
19
- RUN pip install --no-cache-dir gradio huggingface-hub hf-transfer numpy
20
 
21
- # 5. Install llama-cpp-python using the OFFICIAL CPU INDEX
22
- # This is safer than a random GitHub link as it auto-matches your OS
23
- RUN pip install llama-cpp-python \
24
- --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
25
 
26
  COPY --chown=user . .
27
 
28
- # Use -u for unbuffered logs (so you see the download progress)
29
  CMD ["python", "-u", "app.py"]
 
1
+ # This image comes with llama-cpp-python PRE-INSTALLED and optimized
2
+ FROM ghcr.io/abetlen/llama-cpp-python:latest
3
 
4
+ # Switch to root to set up the HF user
5
+ USER root
6
+ RUN apt-get update && apt-get install -y curl git procps && rm -rf /var/lib/apt/lists/*
 
7
 
8
+ # Setup HF compatible user
9
  RUN useradd -m -u 1000 user
10
+ WORKDIR /home/user/app
 
 
11
 
12
+ # Install the few extra things we need
13
+ RUN pip install --no-cache-dir gradio huggingface-hub hf-transfer
 
 
 
 
14
 
15
+ # Give permissions to the user
16
+ RUN chown -R user:user /home/user/app
17
+ USER user
 
18
 
19
  COPY --chown=user . .
20
 
21
+ # Use the same app.py logic
22
  CMD ["python", "-u", "app.py"]