ChatbotDemo / Dockerfile
Kalpokoch's picture
structured
20fbd2c
raw
history blame
1.01 kB
# Base image
FROM python:3.10-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
wget \
build-essential \
cmake \
libopenblas-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy app code
COPY . .
# Download TinyLlama GGUF model from Hugging Face
RUN mkdir -p /app/models && \
wget -O /app/models/TinyLlama.gguf \
https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-GGUF/resolve/main/TinyLlama-1.1B-Chat-v1.0.Q4_K_M.gguf
# Clone and build llama.cpp
RUN git clone https://github.com/ggerganov/llama.cpp.git /app/llama.cpp && \
cd /app/llama.cpp && \
mkdir -p build && cd build && \
cmake .. -DLLAMA_BUILD_EXAMPLES=ON -DLLAMA_BUILD_SERVER=OFF && \
cmake --build . --config Release
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Expose the port
EXPOSE 7860
# Run FastAPI app
CMD ["uvicorn", "app.app:app", "--host", "0.0.0.0", "--port", "7860"]