# Use an official Python runtime as a base image | |
FROM python:3.10-slim | |
# Set environment variables | |
ENV TRANSFORMERS_CACHE=/app/cache \ | |
HF_HOME=/app/cache \ | |
DEBIAN_FRONTEND=noninteractive | |
# Set working directory | |
WORKDIR /app | |
# Install minimal system dependencies for running the app | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
libgomp1 \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Prepare cache directory | |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache | |
# Copy requirements and install Python packages | |
COPY requirements.txt . | |
# Install most packages from requirements.txt, then llama-cpp-python with binary-only | |
RUN grep -v "llama-cpp-python" requirements.txt | pip install --no-cache-dir -r /dev/stdin \ | |
&& pip install --no-cache-dir --only-binary=all llama-cpp-python==0.3.14 | |
# Copy application code and data | |
COPY app.py cv_embeddings.json cv_text.txt ./ | |
# Expose the port your FastAPI app runs on | |
EXPOSE 7860 | |
# Launch | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |