This project provides a Dockerfile for the Rerankers API, a FastAPI-based REST API for reranking documents based on queries using models from the rerankers Python library. The API supports multiple reranking models, including FlashRank (default) and Colbert. The Dockerfile allows for easy containerization and deployment of the API. Simply clone the repository, build the Docker image, and run the container to start using the API.
Below is an example Dockerfile used to containerize the API:
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Install build dependencies required by setuptools
RUN pip install setuptools
RUN mkdir "/app"
# Copy the pyproject.toml file and application code
COPY README.md /app/README.md
COPY LICENSE /app/LICENSE
COPY pyproject.toml /app/pyproject.toml
COPY rerankers /app/rerankers
COPY rest /app/rest
# Set the working directory in the container
WORKDIR /app
# Install project dependencies specified in pyproject.toml
RUN pip install .
# Set environment variable to configure the ranker model (optional)
# ENV RANKER_MODEL=flashrank # You can uncomment this line to set a default ranker model
# Expose port 8000 for the Uvicorn server
EXPOSE 8000
# Command to run the FastAPI app using Uvicorn
CMD ["uvicorn", "rest.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
docker run -p 8000:8000 rerankers-api
Content type
Image
Digest
sha256:a15dabb8c…
Size
736.8 MB
Last updated
about 5 hours ago
docker pull gabauer/rerankers-api:0.6.0-transformer-optimized-v2