Initial upload of Dockerfile
Browse files- Dockerfile +45 -0
Dockerfile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.12-slim
|
| 2 |
+
|
| 3 |
+
# Install system dependencies for building llama-cpp-python
|
| 4 |
+
RUN apt-get update && apt-get install -y \
|
| 5 |
+
build-essential \
|
| 6 |
+
python3-dev \
|
| 7 |
+
cmake \
|
| 8 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
+
|
| 10 |
+
# Set working directory
|
| 11 |
+
WORKDIR /app
|
| 12 |
+
|
| 13 |
+
# Install required Python libraries
|
| 14 |
+
RUN pip install --no-cache-dir \
|
| 15 |
+
fastapi \
|
| 16 |
+
uvicorn \
|
| 17 |
+
pydantic \
|
| 18 |
+
huggingface_hub==0.35.3 \
|
| 19 |
+
pandas==2.2.2 \
|
| 20 |
+
tiktoken==0.12.0 \
|
| 21 |
+
pymupdf==1.26.5 \
|
| 22 |
+
langchain==0.3.27 \
|
| 23 |
+
langchain-community==0.3.31 \
|
| 24 |
+
chromadb==1.1.1 \
|
| 25 |
+
sentence-transformers==5.1.1 \
|
| 26 |
+
llama-cpp-python==0.2.28 \
|
| 27 |
+
'numpy<2.1.0'
|
| 28 |
+
|
| 29 |
+
# Copy the application logic and FastAPI server
|
| 30 |
+
COPY app_logic.py main.py ./
|
| 31 |
+
|
| 32 |
+
# Copy the persistent vector database directory
|
| 33 |
+
COPY chroma_db/ ./chroma_db/
|
| 34 |
+
|
| 35 |
+
# Create the directory structure for the model to match main.py's MODEL_PATH
|
| 36 |
+
RUN mkdir -p /root/.cache/huggingface/hub/models--TheBloke--Mistral-7B-Instruct-v0.1-GGUF/snapshots/731a9fc8f06f5f5e2db8a0cf9d256197eb6e05d1/
|
| 37 |
+
|
| 38 |
+
# Copy the quantized model file to the snapshot directory
|
| 39 |
+
COPY mistral-7b-instruct-v0.1.Q4_K_M.gguf /root/.cache/huggingface/hub/models--TheBloke--Mistral-7B-Instruct-v0.1-GGUF/snapshots/731a9fc8f06f5f5e2db8a0cf9d256197eb6e05d1/
|
| 40 |
+
|
| 41 |
+
# Expose port 8000 for FastAPI
|
| 42 |
+
EXPOSE 8000
|
| 43 |
+
|
| 44 |
+
# Command to start the FastAPI application
|
| 45 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|