Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +23 -1
Dockerfile
CHANGED
|
@@ -1,8 +1,30 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
WORKDIR /app
|
|
|
|
|
|
|
| 4 |
COPY requirements.txt .
|
| 5 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
COPY . .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# Install system dependencies for llama.cpp
|
| 4 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
+
build-essential \
|
| 6 |
+
cmake \
|
| 7 |
+
git \
|
| 8 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
+
|
| 10 |
WORKDIR /app
|
| 11 |
+
|
| 12 |
+
# Copy requirement list first for caching
|
| 13 |
COPY requirements.txt .
|
|
|
|
| 14 |
|
| 15 |
+
# Install Python dependencies (llama-cpp-python compiled with BLAS disabled for HF CPU Spaces)
|
| 16 |
+
RUN CMAKE_ARGS="-DLLAMA_BLAS=OFF -DLLAMA_CUBLAS=OFF" \
|
| 17 |
+
pip install --no-cache-dir -r requirements.txt
|
| 18 |
+
|
| 19 |
+
# Copy app files
|
| 20 |
COPY . .
|
| 21 |
+
|
| 22 |
+
# Pre-download model at build time to speed up startup
|
| 23 |
+
RUN python -c "from huggingface_hub import hf_hub_download; \
|
| 24 |
+
hf_hub_download(repo_id='bartowski/Llama-3.2-3B-Instruct-GGUF', \
|
| 25 |
+
filename='Llama-3.2-3B-Instruct-Q4_K_M.gguf', \
|
| 26 |
+
cache_dir='/app/models', local_dir_use_symlinks=False)"
|
| 27 |
+
|
| 28 |
+
EXPOSE 7860
|
| 29 |
+
|
| 30 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|