FROM python:3.12-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ libpq-dev gcc \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . # CPU-only torch first — sentence-transformers would otherwise pull the much larger CUDA wheels, # which are useless in this container and roughly double the image size. RUN pip install --no-cache-dir torch==2.5.1 --index-url https://download.pytorch.org/whl/cpu RUN pip install --no-cache-dir -r requirements.txt COPY . . EXPOSE 8000 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]