Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +14 -10
Dockerfile
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
|
|
|
|
|
| 1 |
# Use the standard Python 3.11 image for maximum compatibility
|
| 2 |
FROM python:3.11
|
| 3 |
|
| 4 |
-
# Install system dependencies
|
| 5 |
-
RUN apt-get update && apt-get install -y
|
|
|
|
|
|
|
| 6 |
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
# Create writable directories
|
| 10 |
RUN mkdir -p /app/.cache /app/vector_database && chmod -R 777 /app
|
| 11 |
|
| 12 |
-
#
|
|
|
|
|
|
|
| 13 |
ENV TRANSFORMERS_CACHE=/app/.cache \
|
| 14 |
HF_HOME=/app/.cache \
|
| 15 |
-
CHROMADB_DISABLE_TELEMETRY=true
|
| 16 |
-
|
| 17 |
-
# Install a specific, VERIFIED pre-built wheel for llama-cpp-python
|
| 18 |
-
RUN pip install --no-cache-dir \
|
| 19 |
-
https://github.com/abetlen/llama-cpp-python/releases/download/v0.2.75/llama_cpp_python-0.2.75-cp311-cp311-manylinux_2_28_x86_64.whl
|
| 20 |
|
| 21 |
-
#
|
|
|
|
| 22 |
COPY requirements.txt .
|
| 23 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 24 |
|
| 25 |
# Copy the application code
|
| 26 |
COPY . .
|
| 27 |
|
| 28 |
-
# ---
|
| 29 |
|
| 30 |
# Expose the application port
|
| 31 |
EXPOSE 7860
|
|
|
|
| 1 |
+
# FINAL DOCKERFILE
|
| 2 |
+
|
| 3 |
# Use the standard Python 3.11 image for maximum compatibility
|
| 4 |
FROM python:3.11
|
| 5 |
|
| 6 |
+
# Install system dependencies needed for compilation
|
| 7 |
+
RUN apt-get update && apt-get install -y \
|
| 8 |
+
curl build-essential cmake \
|
| 9 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
# Create writable directories
|
| 14 |
RUN mkdir -p /app/.cache /app/vector_database && chmod -R 777 /app
|
| 15 |
|
| 16 |
+
# --- THE KEY FIX ---
|
| 17 |
+
# Set CMAKE_ARGS to tell llama-cpp-python to build without GPU support,
|
| 18 |
+
# which makes the compilation faster.
|
| 19 |
ENV TRANSFORMERS_CACHE=/app/.cache \
|
| 20 |
HF_HOME=/app/.cache \
|
| 21 |
+
CHROMADB_DISABLE_TELEMETRY=true \
|
| 22 |
+
CMAKE_ARGS="-DLLAMA_CUBLAS=OFF"
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
# Copy and install Python requirements.
|
| 25 |
+
# THIS STEP WILL BE VERY SLOW. Please allow up to 30 minutes.
|
| 26 |
COPY requirements.txt .
|
| 27 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 28 |
|
| 29 |
# Copy the application code
|
| 30 |
COPY . .
|
| 31 |
|
| 32 |
+
# --- NOTE: The model is downloaded by app.py at runtime ---
|
| 33 |
|
| 34 |
# Expose the application port
|
| 35 |
EXPOSE 7860
|