Update Dockerfile
Browse files- Dockerfile +8 -5
Dockerfile
CHANGED
|
@@ -2,19 +2,22 @@ FROM python:3.10-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# 1. Install minimal system tools
|
| 6 |
-
RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
-
# 2.
|
|
|
|
|
|
|
|
|
|
| 9 |
RUN pip install --no-cache-dir "numpy<2" fastapi uvicorn pydantic requests
|
| 10 |
|
| 11 |
-
#
|
| 12 |
RUN pip install --no-cache-dir \
|
| 13 |
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu \
|
| 14 |
--only-binary llama-cpp-python \
|
| 15 |
llama-cpp-python
|
| 16 |
|
| 17 |
-
#
|
| 18 |
RUN --mount=type=secret,id=HF_TOKEN,mode=0444 \
|
| 19 |
wget --header="Authorization: Bearer $(cat /run/secrets/HF_TOKEN)" \
|
| 20 |
https://huggingface.co/bartowski/google_gemma-4-E2B-it-GGUF/resolve/main/google_gemma-4-E2B-it-Q4_K_M.gguf \
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# 1. Install minimal system tools AND musl-dev to fix the libc conflict
|
| 6 |
+
RUN apt-get update && apt-get install -y wget musl-dev && rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
+
# 2. Create the symlink so the wheel can find the musl shared object file
|
| 9 |
+
RUN ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
|
| 10 |
+
|
| 11 |
+
# 3. Pin Numpy to prevent the 2.0+ compatibility breaks
|
| 12 |
RUN pip install --no-cache-dir "numpy<2" fastapi uvicorn pydantic requests
|
| 13 |
|
| 14 |
+
# 4. Install llama-cpp-python dynamically but strictly forbid compiling
|
| 15 |
RUN pip install --no-cache-dir \
|
| 16 |
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu \
|
| 17 |
--only-binary llama-cpp-python \
|
| 18 |
llama-cpp-python
|
| 19 |
|
| 20 |
+
# 5. Download model using the HF_TOKEN secret
|
| 21 |
RUN --mount=type=secret,id=HF_TOKEN,mode=0444 \
|
| 22 |
wget --header="Authorization: Bearer $(cat /run/secrets/HF_TOKEN)" \
|
| 23 |
https://huggingface.co/bartowski/google_gemma-4-E2B-it-GGUF/resolve/main/google_gemma-4-E2B-it-Q4_K_M.gguf \
|