Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +28 -1
Dockerfile
CHANGED
|
@@ -1,5 +1,32 @@
|
|
| 1 |
# Using the specified base image that's suited for llama-cpp-python
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
VOLUME ["/models"]
|
| 5 |
|
|
|
|
| 1 |
# Using the specified base image that's suited for llama-cpp-python
|
| 2 |
+
# Define the image argument and provide a default value
|
| 3 |
+
ARG IMAGE=python:3-slim-bullseye
|
| 4 |
+
|
| 5 |
+
# Use the image as specified
|
| 6 |
+
FROM ${IMAGE}
|
| 7 |
+
|
| 8 |
+
# Re-declare the ARG after FROM
|
| 9 |
+
ARG IMAGE
|
| 10 |
+
|
| 11 |
+
# Update and upgrade the existing packages
|
| 12 |
+
RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
|
| 13 |
+
python3 \
|
| 14 |
+
python3-pip \
|
| 15 |
+
ninja-build \
|
| 16 |
+
build-essential
|
| 17 |
+
|
| 18 |
+
RUN python3 -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi uvicorn sse-starlette pydantic-settings starlette-context
|
| 19 |
+
|
| 20 |
+
# Perform the conditional installations based on the image
|
| 21 |
+
RUN echo "Image: ${IMAGE}" && \
|
| 22 |
+
if [ "${IMAGE}" = "python:3-slim-bullseye" ] ; then \
|
| 23 |
+
echo "OpenBLAS install:" && \
|
| 24 |
+
apt-get install -y --no-install-recommends libopenblas-dev && \
|
| 25 |
+
LLAMA_OPENBLAS=1 pip install llama-cpp-python --verbose; \
|
| 26 |
+
else \
|
| 27 |
+
echo "CuBLAS install:" && \
|
| 28 |
+
LLAMA_CUBLAS=1 pip install llama-cpp-python --verbose; \
|
| 29 |
+
fi
|
| 30 |
|
| 31 |
VOLUME ["/models"]
|
| 32 |
|