Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +19 -19
Dockerfile
CHANGED
|
@@ -1,39 +1,39 @@
|
|
| 1 |
-
# Use official Python
|
| 2 |
-
FROM python:3.11
|
| 3 |
|
| 4 |
# Install system dependencies
|
| 5 |
RUN apt-get update && apt-get install -y \
|
|
|
|
| 6 |
build-essential \
|
| 7 |
-
cmake \
|
| 8 |
-
git \
|
| 9 |
-
curl \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
# Set working directory
|
| 13 |
WORKDIR /app
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
RUN curl -L -o /app/tinyllama_dop_q4_k_m.gguf \
|
| 17 |
-
https://huggingface.co/Kalpokoch/FinetunedQuantizedTinyLama/resolve/main/tinyllama_dop_q4_k_m.gguf
|
| 18 |
-
|
| 19 |
-
# Set Hugging Face and ChromaDB cache directories
|
| 20 |
ENV TRANSFORMERS_CACHE=/app/.cache \
|
| 21 |
HF_HOME=/app/.cache \
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
|
|
|
| 27 |
|
| 28 |
-
# Install Python dependencies
|
| 29 |
COPY requirements.txt .
|
| 30 |
-
RUN pip install -
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
# Copy
|
| 33 |
COPY . .
|
| 34 |
|
| 35 |
-
# Expose
|
| 36 |
EXPOSE 7860
|
| 37 |
|
| 38 |
-
#
|
| 39 |
CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Use official Python image with basic system utilities
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
|
| 4 |
# Install system dependencies
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
+
wget \
|
| 7 |
build-essential \
|
|
|
|
|
|
|
|
|
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
# Set working directory
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
+
# Set HF cache dir for transformers, chromadb, etc.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
ENV TRANSFORMERS_CACHE=/app/.cache \
|
| 15 |
HF_HOME=/app/.cache \
|
| 16 |
+
PIP_NO_CACHE_DIR=true
|
| 17 |
+
|
| 18 |
+
# Create required dirs with open permissions
|
| 19 |
+
RUN mkdir -p /app/.cache /app/vector_database && chmod -R 777 /app/.cache /app/vector_database
|
| 20 |
|
| 21 |
+
# Pre-download your quantized GGUF model from HF
|
| 22 |
+
# (Replace with your exact file path if different)
|
| 23 |
+
RUN wget https://huggingface.co/Kalpokoch/FinetunedQuantizedTinyLama/resolve/main/tinyllama_dop_q4_k_m.gguf -O /app/tinyllama_dop_q4_k_m.gguf
|
| 24 |
|
| 25 |
+
# Install Python dependencies separately to leverage Docker caching
|
| 26 |
COPY requirements.txt .
|
| 27 |
+
RUN pip install -r requirements.txt
|
| 28 |
+
|
| 29 |
+
# Install llama-cpp-python from wheel (avoid compilation)
|
| 30 |
+
RUN pip install llama-cpp-python --prefer-binary
|
| 31 |
|
| 32 |
+
# Copy the app code
|
| 33 |
COPY . .
|
| 34 |
|
| 35 |
+
# Expose port for FastAPI
|
| 36 |
EXPOSE 7860
|
| 37 |
|
| 38 |
+
# Launch app
|
| 39 |
CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "7860"]
|