Dockerfile packages the FastAPI service and all native dependencies so you can go from zero to a working highlight endpoint in a few commands.
Prerequisites
- Docker installed and running on your machine or server.
Deploy the Service
Clone or download the project
Grab the source code from the repository and change into the project directory.
Build the Docker image
Build the image and tag it The build step installs Python dependencies and the required native PDF libraries inside the image. This only needs to run once (or whenever you update the project).
rag-pdf-highlighter.Run the container
Start the container and map port The service starts automatically. You should see Uvicorn log output confirming it is listening.
8000 on your host to port 8000 inside the container.Use a Custom Port
By default the service listens on port8000. Override this with the PORT environment variable — remember to update both the -e flag and the -p mapping so they match.
The container is built on
python:3.12-slim and includes libmupdf-dev pre-installed, which provides the native PDF rendering capabilities that power the highlighting engine. You do not need to install any additional system packages.Production Tips
- Scale to zero freely. RAG PDF Highlighter is fully stateless — it holds no in-memory session data between requests. You can safely stop, restart, or scale the container without losing any state.
- Serve over HTTPS. Put the container behind a reverse proxy such as Nginx or a cloud load balancer that terminates TLS. Avoid exposing port
8000directly to the public internet. - Resource limits. PDF processing is CPU-bound. Set appropriate
--cpusand--memorylimits in production to prevent a single large PDF from starving other workloads.