erdemozkan commited on
Commit
653f5a5
·
verified ·
1 Parent(s): fc1af95

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -14
Dockerfile CHANGED
@@ -1,27 +1,30 @@
1
- # Use a stable Debian base
2
- FROM python:3.10-slim-bullseye
3
 
4
- # Install the critical library for OpenMP (llama-cpp needs this)
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
- # We install a specific version that has a 'glibc' wheel for Python 3.10
15
- # This avoids the 'musl' error and the 40-minute build timeout
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 UI and Hub tools
21
- RUN pip install --no-cache-dir gradio huggingface_hub
22
-
23
- # Copy app files
24
  COPY --chown=user . $HOME/app
25
 
26
- # Must listen on 7860 for HF Docker
27
  CMD ["python", "app.py"]
 
1
+ # Use Alpine Linux to natively support the 'musl' wheel that pip is grabbing
2
+ FROM python:3.10-alpine
3
 
4
+ # Install system dependencies Alpine needs for C++ and model downloading
5
+ RUN apk add --no-cache \
6
+ libstdc++ \
7
+ g++ \
8
+ make \
9
+ cmake \
10
+ curl \
11
+ linux-headers \
12
+ git
13
 
14
+ # Set up the HF user (Required)
15
+ RUN adduser -D -u 1000 user
16
  USER user
17
  ENV HOME=/home/user \
18
  PATH=/home/user/.local/bin:$PATH
19
  WORKDIR $HOME/app
20
 
21
+ # This will now pull the musl wheel and ACTUALLY run it
 
22
  RUN pip install --no-cache-dir \
23
  --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu \
24
+ llama-cpp-python==0.2.90 gradio huggingface_hub
25
 
26
+ # Copy your files
 
 
 
27
  COPY --chown=user . $HOME/app
28
 
29
+ # Port 7860 is mandatory for HF Docker
30
  CMD ["python", "app.py"]