Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +13 -7
Dockerfile
CHANGED
|
@@ -1,11 +1,15 @@
|
|
| 1 |
FROM python:3.10-alpine
|
| 2 |
|
| 3 |
-
# 1. Install
|
|
|
|
| 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
|
|
@@ -14,15 +18,17 @@ ENV HOME=/home/user \
|
|
| 14 |
PATH=/home/user/.local/bin:$PATH
|
| 15 |
WORKDIR $HOME/app
|
| 16 |
|
| 17 |
-
# 2.
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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"]
|
|
|
|
| 1 |
FROM python:3.10-alpine
|
| 2 |
|
| 3 |
+
# 1. Install build tools + compatibility layers + math libs
|
| 4 |
+
# musl-dev and build-base are MANDATORY to fix the "Could not find compiler" error
|
| 5 |
RUN apk add --no-cache \
|
| 6 |
+
build-base \
|
| 7 |
+
cmake \
|
| 8 |
+
musl-dev \
|
| 9 |
libc6-compat \
|
| 10 |
libstdc++ \
|
| 11 |
libgomp \
|
| 12 |
+
openblas-dev \
|
| 13 |
libgcc
|
| 14 |
|
| 15 |
RUN adduser -D -u 1000 user
|
|
|
|
| 18 |
PATH=/home/user/.local/bin:$PATH
|
| 19 |
WORKDIR $HOME/app
|
| 20 |
|
| 21 |
+
# 2. Set environment variables to optimize the build for Alpine's CPU
|
| 22 |
+
ENV CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
|
| 23 |
+
|
| 24 |
+
# 3. Install packages
|
| 25 |
+
# Note: This will take a few minutes because it has to compile.
|
| 26 |
+
# This is the ONLY way to make it work on Alpine.
|
| 27 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 28 |
pip install --no-cache-dir flask flask-cors huggingface-hub && \
|
| 29 |
+
pip install --no-cache-dir llama-cpp-python
|
|
|
|
| 30 |
|
| 31 |
COPY --chown=user . $HOME/app
|
| 32 |
|
|
|
|
| 33 |
EXPOSE 7860
|
| 34 |
CMD ["python", "app.py"]
|