ChatbotDemo / Dockerfile
Kalpokoch's picture
updated
a9681af
raw
history blame
1.67 kB
# FINAL DOCKERFILE
# Use the standard Python 3.11 image for maximum compatibility
FROM python:3.11
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl build-essential cmake \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Create writable directories
RUN mkdir -p /app/.cache /app/vector_database && chmod -R 777 /app
# Set environment variables
ENV TRANSFORMERS_CACHE=/app/.cache \
HF_HOME=/app/.cache \
CHROMADB_DISABLE_TELEMETRY=true
# --- FIX: Install a specific and VERIFIED pre-built wheel ---
RUN pip install --no-cache-dir \
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
# Install the rest of the dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# --- ADDED: Auto-generate the granular context file ---
# 1. Copy the raw data and the processing script
COPY combined_context.jsonl .
COPY create_granular_chunks.py .
# 2. Run the script to create 'processed_chunks.json'
RUN python create_granular_chunks.py
# 3. Clean up the raw data and script, as they are no longer needed
RUN rm combined_context.jsonl create_granular_chunks.py
# ----------------------------------------------------
# Copy the application code
COPY ./app ./app
# Download your GGUF model
RUN curl -fL -o /app/phi1.5_dop_q4_k_m.gguf \
https://huggingface.co/Kalpokoch/Phi1.5QuantizedFineTuned/resolve/main/dop-phi-1.5_q4_k_m.gguf \
&& echo "✅ Model downloaded."
# Expose the application port
EXPOSE 7860
# Run the FastAPI application
CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "7860"]