Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -19
Dockerfile
CHANGED
|
@@ -1,35 +1,30 @@
|
|
| 1 |
-
FROM python:3.11
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
| 4 |
-
FORCE_CMAKE=1 \
|
| 5 |
PYTHONUNBUFFERED=1
|
| 6 |
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
-
#
|
| 10 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
git \
|
| 14 |
-
pkg-config \
|
| 15 |
-
libopenblas-dev \
|
| 16 |
-
libomp-dev \
|
| 17 |
-
libgomp1 \
|
| 18 |
-
python3-dev \
|
| 19 |
&& rm -rf /var/lib/apt/lists/*
|
| 20 |
|
| 21 |
-
# Copy
|
| 22 |
COPY requirements.txt /app/requirements.txt
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
RUN
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
pip install --no-cache-dir -r /app/requirements.txt
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
RUN pip install --no-cache-dir llama-cpp-python
|
| 30 |
-
|
| 31 |
-
# Copy app sources
|
| 32 |
COPY app.py /app/app.py
|
| 33 |
|
| 34 |
EXPOSE 7860 7861
|
| 35 |
-
|
|
|
|
|
|
| 1 |
+
FROM python:3.11-slim
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive \
|
|
|
|
| 4 |
PYTHONUNBUFFERED=1
|
| 5 |
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
+
# Minimal tools to download the wheel
|
| 9 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
+
ca-certificates \
|
| 11 |
+
curl \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Copy requirements (do NOT include llama-cpp-python here; it's installed separately)
|
| 15 |
COPY requirements.txt /app/requirements.txt
|
| 16 |
|
| 17 |
+
# Download the prebuilt wheel and install it, then install other Python deps
|
| 18 |
+
RUN mkdir -p /wheels && \
|
| 19 |
+
curl -L -o /wheels/llama_cpp_python-0.2.75+cpubasic-cp311-cp311-linux_x86_64.whl \
|
| 20 |
+
"https://github.com/kuwaai/llama-cpp-python-wheels/releases/download/cpu/llama_cpp_python-0.2.75+cpubasic-cp311-cp311-linux_x86_64.whl" && \
|
| 21 |
+
pip install --upgrade pip setuptools wheel && \
|
| 22 |
+
pip install --no-cache-dir /wheels/llama_cpp_python-0.2.75+cpubasic-cp311-cp311-linux_x86_64.whl && \
|
| 23 |
pip install --no-cache-dir -r /app/requirements.txt
|
| 24 |
|
| 25 |
+
# Copy app sources last to keep previous layers cacheable
|
|
|
|
|
|
|
|
|
|
| 26 |
COPY app.py /app/app.py
|
| 27 |
|
| 28 |
EXPOSE 7860 7861
|
| 29 |
+
|
| 30 |
+
CMD ["python", "app.py"]
|