Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +11 -15
Dockerfile
CHANGED
|
@@ -1,15 +1,12 @@
|
|
| 1 |
FROM python:3.10-alpine
|
| 2 |
|
| 3 |
-
# 1. Install
|
| 4 |
-
# build-base = gcc, g++, make
|
| 5 |
-
# openblas-dev = fast math for the CPU
|
| 6 |
RUN apk add --no-cache \
|
| 7 |
-
|
| 8 |
-
cmake \
|
| 9 |
-
git \
|
| 10 |
libstdc++ \
|
| 11 |
-
|
| 12 |
-
|
|
|
|
| 13 |
|
| 14 |
RUN adduser -D -u 1000 user
|
| 15 |
USER user
|
|
@@ -17,16 +14,15 @@ ENV HOME=/home/user \
|
|
| 17 |
PATH=/home/user/.local/bin:$PATH
|
| 18 |
WORKDIR $HOME/app
|
| 19 |
|
| 20 |
-
# 2.
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
# 3. Install Python packages
|
| 24 |
-
# This WILL take 5-10 minutes because Alpine has to build the AI engine from scratch.
|
| 25 |
-
# DO NOT cancel it when you see "Building wheel for llama-cpp-python".
|
| 26 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 27 |
pip install --no-cache-dir flask flask-cors huggingface-hub && \
|
| 28 |
-
pip install --no-cache-dir llama-cpp-python
|
|
|
|
| 29 |
|
| 30 |
COPY --chown=user . $HOME/app
|
| 31 |
|
|
|
|
|
|
|
| 32 |
CMD ["python", "app.py"]
|
|
|
|
| 1 |
FROM python:3.10-alpine
|
| 2 |
|
| 3 |
+
# 1. Install the compatibility layer for glibc wheels + math libs
|
|
|
|
|
|
|
| 4 |
RUN apk add --no-cache \
|
| 5 |
+
libc6-compat \
|
|
|
|
|
|
|
| 6 |
libstdc++ \
|
| 7 |
+
libgomp \
|
| 8 |
+
openblas \
|
| 9 |
+
libgcc
|
| 10 |
|
| 11 |
RUN adduser -D -u 1000 user
|
| 12 |
USER user
|
|
|
|
| 14 |
PATH=/home/user/.local/bin:$PATH
|
| 15 |
WORKDIR $HOME/app
|
| 16 |
|
| 17 |
+
# 2. Install using the pre-built CPU wheels index
|
| 18 |
+
# This skips the "Building Wheel" phase and downloads the .whl directly
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 20 |
pip install --no-cache-dir flask flask-cors huggingface-hub && \
|
| 21 |
+
pip install --no-cache-dir llama-cpp-python \
|
| 22 |
+
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 23 |
|
| 24 |
COPY --chown=user . $HOME/app
|
| 25 |
|
| 26 |
+
# Ensure we use the right port for Hugging Face
|
| 27 |
+
EXPOSE 7860
|
| 28 |
CMD ["python", "app.py"]
|