Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +19 -15
Dockerfile
CHANGED
|
@@ -1,27 +1,31 @@
|
|
| 1 |
-
|
| 2 |
-
FROM python:3.10-bookworm
|
| 3 |
|
| 4 |
-
# Install
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
| 7 |
cmake \
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
RUN
|
| 12 |
USER user
|
| 13 |
ENV HOME=/home/user \
|
| 14 |
PATH=/home/user/.local/bin:$PATH
|
| 15 |
WORKDIR $HOME/app
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 20 |
-
pip install --no-cache-dir \
|
| 21 |
-
|
| 22 |
-
flask-cors \
|
| 23 |
-
huggingface-hub \
|
| 24 |
-
llama-cpp-python==0.3.2 --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
|
| 25 |
|
| 26 |
COPY --chown=user . $HOME/app
|
| 27 |
|
|
|
|
| 1 |
+
FROM python:3.10-alpine
|
|
|
|
| 2 |
|
| 3 |
+
# 1. Install Alpine-specific build tools
|
| 4 |
+
# build-base = gcc, g++, make
|
| 5 |
+
# openblas-dev = fast math for the CPU
|
| 6 |
+
RUN apk add --no-cache \
|
| 7 |
+
build-base \
|
| 8 |
cmake \
|
| 9 |
+
git \
|
| 10 |
+
libstdc++ \
|
| 11 |
+
openblas-dev \
|
| 12 |
+
python3-dev
|
| 13 |
|
| 14 |
+
RUN adduser -D -u 1000 user
|
| 15 |
USER user
|
| 16 |
ENV HOME=/home/user \
|
| 17 |
PATH=/home/user/.local/bin:$PATH
|
| 18 |
WORKDIR $HOME/app
|
| 19 |
|
| 20 |
+
# 2. Set environment variables to tell llama-cpp to use the Alpine math libraries
|
| 21 |
+
ENV CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
|
| 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 |
|