FROM python:3.9-slim-buster | |
# Set environment variables | |
ENV PYTHONUNBUFFERED=1 \ | |
HF_HOME="/tmp/hf_cache" \ | |
TRANSFORMERS_CACHE="/tmp/hf_cache/transformers" \ | |
HF_DATASETS_CACHE="/tmp/hf_cache/datasets" \ | |
SENTENCE_TRANSFORMERS_HOME="/tmp/hf_cache/sentence_transformers" | |
# Create app directory | |
WORKDIR /app | |
# Install system dependencies for llama-cpp-python (if needed, often included in base image) | |
# RUN apt-get update && apt-get install -y --no-install-recommends \ | |
# build-essential \ | |
# cmake \ | |
# libopenblas-dev \ | |
# && rm -rf /var/lib/apt/lists/* | |
# Copy requirements file and install Python dependencies | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy application code | |
COPY . . | |
# Expose the port FastAPI will run on | |
EXPOSE 7860 | |
# Command to run the application | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |