FROM python:3.13-slim # Install curl for uv installation and openssl for RSA key generation RUN apt-get update && apt-get install -y curl openssl && rm -rf /var/lib/apt/lists/* # Install uv RUN curl -LsSf https://astral.sh/uv/install.sh | sh ENV PATH="/root/.local/bin:$PATH" # Set working directory WORKDIR /app # Copy Python dependencies COPY pyproject.toml uv.lock ./ RUN uv sync # Copy sample document and warmup script for docling COPY documents/2506.08231v1.pdf ./ COPY warm_up_docling.py ./ RUN uv run python warm_up_docling.py && rm warm_up_docling.py 2506.08231v1.pdf # Copy Python source COPY src/ ./src/ # Generate RSA keys for JWT signing if they don't exist RUN mkdir -p keys && \ if [ ! -f keys/private_key.pem ]; then \ openssl genrsa -out keys/private_key.pem 2048 && \ openssl rsa -in keys/private_key.pem -pubout -out keys/public_key.pem && \ echo "Generated RSA keys for JWT signing"; \ fi # Expose backend port EXPOSE 8000 # Start backend in foreground CMD ["uv", "run", "python", "src/main.py"]