erdemozkan commited on
Commit
5f98e7e
·
verified ·
1 Parent(s): 345c682

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -8
Dockerfile CHANGED
@@ -1,19 +1,27 @@
1
- # This image already has llama-cpp-python PRE-INSTALLED for CPU. No building!
2
- FROM ghcr.io/abetlen/llama-cpp-python:latest-cpu
3
 
4
- # Switch to root to install Gradio, then back to user for security
5
- USER root
6
- RUN pip install --no-cache-dir gradio huggingface_hub
7
 
8
- # Set up the Hugging Face standard user
9
  RUN useradd -m -u 1000 user
10
  USER user
11
  ENV HOME=/home/user \
12
  PATH=/home/user/.local/bin:$PATH
13
  WORKDIR $HOME/app
14
 
15
- # Copy your files
 
 
 
 
 
 
 
 
 
16
  COPY --chown=user . $HOME/app
17
 
18
- # Start the app
19
  CMD ["python", "app.py"]
 
1
+ # Standard image that Hugging Face always has in stock
2
+ FROM python:3.10-slim-bullseye
3
 
4
+ # Install the ONLY system library needed for the math engine
5
+ RUN apt-get update && apt-get install -y libgomp1 curl && rm -rf /var/lib/apt/lists/*
 
6
 
7
+ # Set up the HF user
8
  RUN useradd -m -u 1000 user
9
  USER user
10
  ENV HOME=/home/user \
11
  PATH=/home/user/.local/bin:$PATH
12
  WORKDIR $HOME/app
13
 
14
+ # Force install the PRE-BUILT CPU binary for Python 3.10
15
+ # This skips the 40-minute compilation entirely
16
+ RUN pip install --no-cache-dir \
17
+ --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu \
18
+ llama-cpp-python==0.2.90
19
+
20
+ # Install Gradio and HF Hub
21
+ RUN pip install --no-cache-dir gradio huggingface_hub
22
+
23
+ # Copy your code
24
  COPY --chown=user . $HOME/app
25
 
26
+ # Port 7860 is mandatory for HF Docker
27
  CMD ["python", "app.py"]