askBot / Dockerfile
Murali Chandran
hugging face implementation CPU/gguf
9dfc96d
Raw History Blame Contribute Delete
1.54 kB
# # 1. Start with an OS that already has CUDA and PyTorch installed
# FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime
# # 2. Set the working directory inside the container
# WORKDIR /app
# # 3. Copy your requirements file and install dependencies
# # (You will need to create a requirements.txt with fastapi, uvicorn, transformers, bitsandbytes, faiss-cpu, sentence-transformers, etc.)
# COPY requirements.txt .
# RUN pip install --no-cache-dir -r requirements.txt
# # 4. Copy your actual code and knowledge base into the container
# COPY . .
# # 5. Open port 8000 so the outside world can talk to the API
# EXPOSE 8000
# # 6. Start the FastAPI server when the container boots
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
# 1. Use a lightweight Python base
FROM python:3.11-slim
# 2. Install system dependencies for building llama-cpp on a CPU
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# 3. Set up a non-root user (Strict Hugging Face Security Requirement)
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# 4. Install your Python dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# 5. Copy your actual code and knowledge base into the container
COPY --chown=user . .
# 6. Run the app using Python so it triggers the dynamic port logic in app.py
CMD ["python", "app.py"]