recommender-backend / Dockerfile
Kareman's picture
first
b5739f3
raw
history blame
1.01 kB
# ---- Base ----
FROM python:3.10-slim
# Set workdir
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy project files (including data/ and faiss_index/)
COPY . /app
# Upgrade pip and install dependencies
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# ---- Pre-download MiniLM embeddings at build time ----
# The model will be stored in the default Hugging Face cache (~/.cache/huggingface)
RUN python -c "from langchain_huggingface import HuggingFaceEmbeddings; HuggingFaceEmbeddings(model_name='sentence-transformers/all-MiniLM-L6-v2')"
# ---- Copy FAISS index to /tmp at runtime ----
# We'll copy them from /app/faiss_index in CMD, since /tmp is the only writable location in Spaces
# We will do this in an entrypoint script
COPY entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
# Expose port
EXPOSE 8000
# Run entrypoint
CMD ["/app/entrypoint.sh"]